This bug report may be distantly related to but (hopefully) is not a dupe of:
[4.3 Regression] Warnings while compiling libobjc with the uleb128 changes
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30731

When I make gcc 4.3.0 I create a "make log" like so:
make 2>&1 | tee make_1_log.txt


File: gcc-4_3-trunk/gcc/configure has this line in it:
"# Check if we have .[us]leb128, and support symbol arithmetic with it."


When I check my log I see this:

# grep leb128 make_16_log.txt
checking assembler for .sleb128 and .uleb128...
/root/downloads/gcc-4_3-trunk/gcc/configure: line 14092: test: too many
arguments
checking assembler for .sleb128 and .uleb128...
/root/downloads/gcc-4_3-trunk/gcc/configure: line 14092: test: too many
arguments
checking assembler for .sleb128 and .uleb128...
/root/downloads/gcc-4_3-trunk/gcc/configure: line 14092: test: too many
arguments
/root/downloads/gcc-4_3-trunk/libobjc/exception.c:94: warning: passing argument
2 of 'read_uleb128' from incompatible pointer type
/root/downloads/gcc-4_3-trunk/libobjc/exception.c:103: warning: passing
argument 2 of 'read_uleb128' from incompatible pointer type
/root/downloads/gcc-4_3-trunk/libobjc/exception.c:234: warning: passing
argument 2 of 'read_uleb128' from incompatible pointer type


Looking at "gcc-4_3-trunk/gcc/configure" I see this:

        # GAS versions before 2.11 do not support uleb128,
  # despite appearing to.
  # ??? There exists an elf-specific test that will crash
  # the assembler.  Perhaps it's better to figure out whether
  # arbitrary sections are supported and try the test.
  as_ver=`$gcc_cv_as --version 2>/dev/null | sed 1q`
  if echo "$as_ver" | grep GNU > /dev/null; then
    as_ver=`echo $as_ver | sed -e 's/GNU assembler \([0-9.][0-9.]*\).*/\1/'`
    as_major=`echo $as_ver | sed 's/\..*//'`
    as_minor=`echo $as_ver | sed 's/[^.]*\.\([0-9]*\).*/\1/'`
    if test $as_major -eq 2 && test $as_minor -lt 11
    then :
    else gcc_cv_as_leb128=yes
    fi
  fi



Running a few commands by hand gives this:

# echo `as --version 2>/dev/null | sed 1q`
GNU assembler (GNU Binutils) 2.17.50.20070426


# echo "GNU assembler (GNU Binutils) 2.17.50.20070426" | sed -e 's/GNU
assembler \([0-9.][0-9.]*\).*/\1/'
GNU assembler (GNU Binutils) 2.17.50.20070426

# echo "GNU assembler (GNU Binutils) 2.17.50.20070426" | sed -e 's/GNU
assembler (GNU Binutils) \([0-9.][0-9.]*\).*/\1/' 
2.17.50.20070426



Testing a few different assemblers that I have I see things like this:

# /usr/bin/as-Origonal --version
GNU assembler 2.17 Debian GNU/Linux

# /usr/bin/as-2.17cvs20070426 --version
GNU assembler (GNU Binutils) 2.17.50.20070426

# /usr/bin/as-2.17.50.20070426 --version
GNU assembler (GNU Binutils for Debian) 2.17.50.20070426


Try a new command string:
# echo "GNU assembler (GNU Binutils) 2.17.50.20070426" | grep -o [0-9.+] | tr
-d [:cntrl:]
2.17.50.20070426


FIX:

# diff -Naur gcc/configure-Origonal gcc/configure
--- gcc/configure-Origonal      2007-06-11 09:02:56.000000000 -0700
+++ gcc/configure       2007-06-11 09:03:56.000000000 -0700
@@ -14086,7 +14086,7 @@
   # arbitrary sections are supported and try the test.
   as_ver=`$gcc_cv_as --version 2>/dev/null | sed 1q`
   if echo "$as_ver" | grep GNU > /dev/null; then
-    as_ver=`echo $as_ver | sed -e 's/GNU assembler \([0-9.][0-9.]*\).*/\1/'`
+    as_ver=`echo $as_ver | grep -o [0-9.+] | tr -d [:cntrl:]
     as_major=`echo $as_ver | sed 's/\..*//'`
     as_minor=`echo $as_ver | sed 's/[^.]*\.\([0-9]*\).*/\1/'`
     if test $as_major -eq 2 && test $as_minor -lt 11

The patch grabs _only_ the version number (without so much as a trailing "\n").


-- 
           Summary: Grep for "as" broken -- configure: line 14092: test: too
                    many arguments sleb128 uleb128
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rob1weld at aol dot com


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

Reply via email to