bugMIT/GNU Scheme - Bugs: bug #40150, mit-scheme-c-9.1.1 overrides user...

 
 

bug #40150: mit-scheme-c-9.1.1 overrides user supplied optimization CFLAGS

Submitter:  George Skabinsky <gska>
Submitted:  Mon 30 Sep 2013 09:35:12 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  None Privacy:  Public
Assigned to:  mhb Originator Name: 
Open/Closed:  Closed
Keywords: 
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 27 May 2014 04:29:36 PM UTC, comment #3: 

This wound up in commit f93e3c6.

Matt Birkholz <mhb>
Group Member
Mon 14 Oct 2013 01:47:01 AM UTC, comment #2: 

yes, that will suffice. thanks.

George Skabinsky <gska>
Thu 03 Oct 2013 06:12:17 PM UTC, comment #1: 

I can find only a handful of lines where CFLAGS is touched at all, mostly to add some -Wnitpick options (admittedly after CFLAGS, but so what?), or override standard optimization options when configured with --enable-debugging (the intention?).  Perhaps line 62 is all you meant; you were so... unspecific.  Line 62 is only executed when ${GCC} is yes, but... maybe this patch is all you need?

diff --git a/src/microcode/achost.ac b/src/microcode/achost.ac
index 35408bb..63e45f1 100644
--- a/src/microcode/achost.ac
+++ b/src/microcode/achost.ac
@@ -59,7 +59,7 @@ if test ${GCC} = yes; then
     LDFLAGS=${SAVED_LDFLAGS}
 
     if test ${enable_debugging} = no; then
- CFLAGS="${CFLAGS} -O3"
+ CFLAGS="-O3 ${CFLAGS}"
     else
  CFLAGS="${CFLAGS} -O0 -g -DENABLE_DEBUGGING_TOOLS"
  LDFLAGS="${LDFLAGS} -g"

Matt Birkholz <mhb>
Group Member
Mon 30 Sep 2013 09:35:12 PM UTC, original submission:  

by default, autoconf'd programs set "-O2 -g" as default CFLAGS.
however they're only used when the user does not pass custom CFLAGS.

so the code there is equivalent to
[ -z $CFLAGS ] && CFLAGS="-O2 -g"

mit scheme otoh has the following:
CFLAGS="$CFLAGS -O3"

thus, -O3 is always added to the end of the CFLAGS, which takes precedence. so the user has no way to override the hardcore -O3 optimization, which takes 5-10 times as long (and much more RAM) to build than -O0.

if otoh the statement would look like this:
CFLAGS="-O3 $CFLAGS"
the user could still override the optimization level since his own CFLAGS come last.

however the best approach is the one taken by vanilla autoconf (first code example).

George Skabinsky <gska>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mhb (Posted a comment)
  • -email is unavailable- added by mhb
  • -email is unavailable- added by gska (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-05-27 mhb Assigned toNone mhb
        Open/ClosedOpen Closed
    2013-10-03 mhb Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code