[Bug other/26764] New: sed command garbled when generating macro_list

eggert at gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Mar 20 06:57:00 GMT 2006


This problem occurs on Solaris 8 when building macro_list.
Here the output of 'make' in the neighborhood:

   echo |  ./xgcc -B./ -B/opt/reb/lib/gcc/gcc-4.1.0/sparc-sun-solaris2.8/bin/
-isystem /opt/reb/lib/gcc/gcc-4.1.0/sparc-sun-solaris2.8/include -isystem
/opt/reb/lib/gcc/gcc-4.1.0/sparc-sun-solaris2.8/sys-include
-L/export/duryea/reb/src/base/gcc/build/gcc/../ld -E -dM - | \
     sed -n 's/^#define \([^_][a-zA-Z0-9_]*\).*/\1/p ; \
           s/^#define \(_[^_A-Z][a-zA-Z0-9_]*\).*/\1/p' | \
     sort -u > tmp-macro_list
   sed: command garbled: s/^#define \([^_][a-zA-Z0-9_]*\).*/\1/p ;  s/^#define
\(_[^_A-Z][a-zA-Z0-9_]*\).*/\1/p
   /bin/ksh /reb/src/base/gcc/gcc-4.1.0/gcc/../move-if-change tmp-macro_list
macro_list
   echo timestamp > s-macro_list

The problem is the sed command.  gcc/Makefile.in relies on unportable
behavior in sed: it passes a script containing backslash-newline to
'sed'.  Some 'sed' implementations ignore the backslash-newline, but
Solaris 8 sed does not, and POSIX does not define the behavior of
backslash-newline outside commands in 'sed' scripts so GCC is relying
on unportable behavior here.

As a result of this bug, the macro_list file is empty, and the
fixincludes procedure does not fix many include files that it should.
For example, the "defined(sun)" strings in <X11/Xos.h> are not
replaced by "defined(__sun__)" as they should be.

I'll attach a patch.


-- 
           Summary: sed command garbled when generating macro_list
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: eggert at gnu dot org
 GCC build triplet: sparc-sun-solaris2.8
  GCC host triplet: sparc-sun-solaris2.8
GCC target triplet: sparc-sun-solaris2.8


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26764



More information about the Gcc-bugs mailing list