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

            Bug ID: 60449
           Summary: Merging function DECLs discards leaf attribute which
                    causes cfg verifier to fail
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jamborm at gcc dot gnu.org

I've come across this verify_flow_info failure when attempting to LTO
build Firefox.  I'm attaching a small testcase (I'm using trunk
revision 208276 on x86-64-linux), to reproduce do:

$ ~/gcc/trunk/inst/bin/gcc -c -O2 -flto gtod1.c 
$ ~/gcc/trunk/inst/bin/gcc -c -O2 -flto gtod2.c
$ ~/gcc/trunk/inst/bin/gcc -O2 -flto gtod1.o gtod2.o 
gtod2.c: In function ‘main’:
gtod2.c:41:5: error: control flow in the middle of basic block 6
 int main (void)
     ^
gtod2.c:41:5: error: control flow in the middle of basic block 6
gtod2.c:41:5: error: control flow in the middle of basic block 6
gtod2.c:41:5: internal compiler error: verify_flow_info failed

The order of .o files in the linking stage is important.

My artificial testcase declares gettimeofday itself, twice, each time
with different attributes on purpose.  When building FF, all
declarations claim to come from /usr/include/sys/time.h, I do not know
why some of them lost or did not get their attributes.

The problem with loosing the leaf attribute is that calls from
function that calls setjmp are considered control flow statements
unless they are without side effects or leaf (see stmt_ends_bb_p,
is_ctrl_altering_stmt and call_can_make_abnormal_goto).  Therefore, if
a leaf attribute is lost, calls to that functions suddenly may need to
break BBs or face the verifiers wrath.

Reply via email to