[Bug 1075243] [NEW] continued lines not always merged into one long line

J. Lewis Muir 1075243 at bugs.launchpad.net
Mon Nov 5 17:14:37 UTC 2012


Public bug reported:

The GCC C preprocessor sometimes incorrectly handles a line continuation
by not joining a following line with the current line.

Attached is a simple C file called continued-line-test.c.  It contains
the following three lines (the first two lines end with a backslash):

struct {\
  int x;\
};

Running gcc with the -E option produces the following:

$ gcc -E continued-line-test.c 
# 1 "continued-line-test.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "continued-line-test.c"
struct {
  int x;};

As you can see, even though the first line in continued-line-test.c
ended with a backslash, the second line was not joined with the first
line.  Of course, this is a simple example, but I have software that
depends on correct line continuation processing in order to build.

The GCC documentation (http://gcc.gnu.org/onlinedocs/gcc-4.6.3/cpp
/Initial-processing.html#Initial-processing) says:

"A continued line is a line which ends with a backslash, `\'. The
backslash is removed and the following line is joined with the current
one. No space is inserted, so you may split a line anywhere, even in the
middle of a word. (It is generally more readable to split lines only at
white space.)"

The observed behavior is inconsistent with this statement from the
documentation.

What I expected to see is the following:

$ gcc -E continued-line-test.c 
# 1 "continued-line-test.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "continued-line-test.c"
struct { int x;};

Here's my Ubuntu version information:

$ lsb_release -rd
Description:	Ubuntu 12.04.1 LTS
Release:	12.04

And here's the package version information:

$ apt-cache policy gcc-4.6
gcc-4.6:
  Installed: 4.6.3-1ubuntu5
  Candidate: 4.6.3-1ubuntu5
  Version table:
 *** 4.6.3-1ubuntu5 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/main i386 Packages
        100 /var/lib/dpkg/status

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: gcc 4:4.6.3-1ubuntu5
ProcVersionSignature: Ubuntu 3.2.0-32.51-generic 3.2.30
Uname: Linux 3.2.0-32-generic i686
NonfreeKernelModules: prl_fs_freeze prl_fs prl_tg prl_eth
ApportVersion: 2.0.1-0ubuntu14
Architecture: i386
Date: Mon Nov  5 10:29:32 2012
InstallationMedia: Ubuntu 10.04.1 LTS "Lucid Lynx" - Release i386 (20100816.1)
ProcEnviron:
 TERM=xterm
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: gcc-defaults
UpgradeStatus: Upgraded to precise on 2012-05-03 (186 days ago)

** Affects: gcc-defaults (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: apport-bug i386 precise running-unity

** Attachment added: "continued-line-test.c"
   https://bugs.launchpad.net/bugs/1075243/+attachment/3424779/+files/continued-line-test.c

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-defaults in Ubuntu.
https://bugs.launchpad.net/bugs/1075243

Title:
  continued lines not always merged into one long line

Status in “gcc-defaults” package in Ubuntu:
  New

Bug description:
  The GCC C preprocessor sometimes incorrectly handles a line
  continuation by not joining a following line with the current line.

  Attached is a simple C file called continued-line-test.c.  It contains
  the following three lines (the first two lines end with a backslash):

  struct {\
    int x;\
  };

  Running gcc with the -E option produces the following:

  $ gcc -E continued-line-test.c 
  # 1 "continued-line-test.c"
  # 1 "<built-in>"
  # 1 "<command-line>"
  # 1 "continued-line-test.c"
  struct {
    int x;};

  As you can see, even though the first line in continued-line-test.c
  ended with a backslash, the second line was not joined with the first
  line.  Of course, this is a simple example, but I have software that
  depends on correct line continuation processing in order to build.

  The GCC documentation (http://gcc.gnu.org/onlinedocs/gcc-4.6.3/cpp
  /Initial-processing.html#Initial-processing) says:

  "A continued line is a line which ends with a backslash, `\'. The
  backslash is removed and the following line is joined with the current
  one. No space is inserted, so you may split a line anywhere, even in
  the middle of a word. (It is generally more readable to split lines
  only at white space.)"

  The observed behavior is inconsistent with this statement from the
  documentation.

  What I expected to see is the following:

  $ gcc -E continued-line-test.c 
  # 1 "continued-line-test.c"
  # 1 "<built-in>"
  # 1 "<command-line>"
  # 1 "continued-line-test.c"
  struct { int x;};

  Here's my Ubuntu version information:

  $ lsb_release -rd
  Description:	Ubuntu 12.04.1 LTS
  Release:	12.04

  And here's the package version information:

  $ apt-cache policy gcc-4.6
  gcc-4.6:
    Installed: 4.6.3-1ubuntu5
    Candidate: 4.6.3-1ubuntu5
    Version table:
   *** 4.6.3-1ubuntu5 0
          500 http://us.archive.ubuntu.com/ubuntu/ precise/main i386 Packages
          100 /var/lib/dpkg/status

  ProblemType: Bug
  DistroRelease: Ubuntu 12.04
  Package: gcc 4:4.6.3-1ubuntu5
  ProcVersionSignature: Ubuntu 3.2.0-32.51-generic 3.2.30
  Uname: Linux 3.2.0-32-generic i686
  NonfreeKernelModules: prl_fs_freeze prl_fs prl_tg prl_eth
  ApportVersion: 2.0.1-0ubuntu14
  Architecture: i386
  Date: Mon Nov  5 10:29:32 2012
  InstallationMedia: Ubuntu 10.04.1 LTS "Lucid Lynx" - Release i386 (20100816.1)
  ProcEnviron:
   TERM=xterm
   PATH=(custom, user)
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  SourcePackage: gcc-defaults
  UpgradeStatus: Upgraded to precise on 2012-05-03 (186 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1075243/+subscriptions




More information about the foundations-bugs mailing list