Bug 172533 - autogen-5.8.8 tests fail if -ggdb or similar is in CFLAGS
Bug#: 172533 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: toolchain@gentoo.org Reported By: kevquinn@gentoo.org
Component: Core system
URL:  http://sourceforge.net/tracker/index.php?func=detail&aid=1691057&group_id=3593&atid=103593
Summary: autogen-5.8.8 tests fail if -ggdb or similar is in CFLAGS
Keywords:  
Status Whiteboard: 
Opened: 2007-03-28 09:50 0000
Description:   Opened: 2007-03-28 09:50 0000
The test autoopts/test/immediate.test fails if CFLAGS contains any of the debug
flags (apart from -g).  This is because it tries to filter those flags out by
using this:

  CFLAGS="-g `echo ${CFLAGS} | \
    sed 's,-O2,,;s/-g//'`"

which clearly replaces -ggdb2 (for example) with -gdb2 - which isn't a valid
CFLAG and the test compilation fails.  A simple fix is to make the sed script a
little more consistent.  The following works:

  CFLAGS="-g `echo ${CFLAGS} | \
    sed 's,-O2,,;s/-g[^ \t]*//g'`"

I figured really they want to remove any -g* flags.  Patch to follow.

------- Comment #1 From Kevin F. Quinn (RETIRED) 2007-03-28 09:51:41 0000 -------
Created an attachment (id=114708) [details]
Fixup insufficient sed script to remove any -g* debug flag, not just drop '-g'

------- Comment #2 From Kevin F. Quinn (RETIRED) 2007-03-28 09:52:56 0000 -------
(In reply to comment #0)
> which clearly replaces -ggdb2 (for example) with -gdb2

I meant it is replaced with 'gdb2' (no '-').

------- Comment #3 From SpanKY 2007-03-30 06:03:25 0000 -------
i've gone with:
+  sed 's,-O2,,;s/-g[^[:space:]]*//'`"

cheers

------- Comment #4 From Mikko Tiihonen 2007-04-21 13:27:32 0000 -------
I just found two new gcc parameters that the fix in the ebuild doesn't handle
but the fix applied upstream does.

--param max-gcse-passes=4
--param max-gcse-memory=209715200

I suggest changing the patch in ebuild to use the sed script from upsteam with
sed 's,-O2,,;s/[ \t][ \t]*-g[^ \t]*[ \t][ \t]*/ /'