using -ftracer stops buildworld at shutdown.c

jason henson jason at ec.rr.com
Tue Jul 26 22:43:43 GMT 2005


Adding -ftracer to my make.conf causes problems with 
/src/sbin/shutdown/shutdown.c
This is my make.conf settings
CPUTYPE=athlon-xp
CFLAGS=-O2 -pipe  -ffast-math  -funroll-loops -ftracer
COPTFLAGES=-O2 -pipe -funroll-loops -ffast-math -ftracer

Doing a little research I found these items:

-ftracer
     Perform tail duplication to enlarge superblock size. This 
transformation simplifies the control flow of the function allowing 
other optimizations to do better job.


  Why do I get "warning: variable (or argument) `blah' might be 
clobbered by `longjmp' or `vfork'" and how do I fix it?

When the C runtime executes a longjmp, the flow of control passes back 
to the last setjmp that was executed. In the process, the stack (which 
contains arguments and local variables) must be 'unwound', that is, 
returned to the exact same state that it was in when setjmp was executed.

Unfortunately, due to optimizations such as storing the value of a 
variable in a register instead of on the stack, the compiler cannot 
always guarantee that the stack will be restored precisely to its 
original state. Thus some local variables and/or arguments can be 
'clobbered'.

To avoid this warning, the variables and/or arguments should be 
prevented from being optimized by declaring them as volatile.

So I sprinkled some volatiles around, but mostly got more errors  that 
said "gcc volatile discards qualifiers from pointer target type" in the 
fprintf functions.

The error went away after I removed -ftracer, but from what I have read 
it would be advantageous to change the variable pf to be stored on the 
stack and not in a register.  That is if it is not stored on the stack. 
  I did a search of all the listed include files in shutdown.c and found 
no matches for pf.

Anyone one have any thoughts or insights on this?  Am I completely off 
in left field?


Jason


===> sbin/shutdown (all)
cc -O2 -pipe -DNOPROFILE -ffast-math -ftracer -funroll-loops 
-march=athlon-xp -Wsystem-headers -Werror -Wall -Wno-format-y2k -W 
-Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes 
-Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch 
-Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Winline 
-Wnested-externs -Wredundant-decls -c /usr/src/sbin/shutdown/shutdown.c
/usr/src/sbin/shutdown/shutdown.c: In function `timewarn':
/usr/src/sbin/shutdown/shutdown.c:276: warning: variable 'pf' might be 
clobbered by `longjmp' or `vfork'
*** Error code 1

Stop in /usr/src/sbin/shutdown.
*** Error code 1

Stop in /usr/src/sbin.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.


More information about the freebsd-hackers mailing list