In a large application, a certain routine from the UMFPACK library is miscompiled when -O is specified. Without optimisation, the routine works fine. This triggers an assertion failure in the code.
I use gcc (GCC) 4.1.0 20051030 (experimental). The problem can be reproduced with the attached source files. To see the error, compile them with /gcc/bin/gcc -g -O -o umfpack-bug umfpack-call.c umf_analyze.i umf_apply_order.i umf_order_front_tree.i umf_dump.i When run, the executable aborts with an assertion failure: /Users/eschnett/Calpha/arrangements/AEIThorns/AHFinderDirect/src/sparse-matrix/umfpack/umf_analyze.c:500: failed assertion `parent == j+1' Abort trap (core dumped) To make the error go away, omit the "-O" option. In this case, the executable runs without producing any output. The error seems to be the following. The routine UMF_analyze contains a large loop in which the local variable pdest is changed. In the next iteration, pdest is reset to the value it had before the loop. This happens only for local variables, not for static or global variables. The error seems to be specific to powerpc; it does not happen on i386. gcc 3.3 does not have this problem. -- Summary: Wrong code generated when optimising Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: schnetter at aei dot mpg dot de GCC build triplet: powerpc-apple-darwin8.2.0 GCC host triplet: powerpc-apple-darwin8.2.0 GCC target triplet: powerpc-apple-darwin8.2.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24716