Created attachment 26868 [details] Preprocessed Source I get the following error when trying to compile a piece of software. Commenting out the call to qsort in the original source file (the corresponding line number in the attached preprocessed file is 7176) does not produce any error. gcc -std=gnu9x -fopenmp -g -O2 -Iinclude -o main main.c src/stinger.c src/stinger-utils.c src/timer.c src/xmalloc.c \ -lm -lrt src/stinger-utils.c: In function ‘stinger_to_sorted_csr’: src/stinger-utils.c:450:13: internal compiler error: in create_tmp_var, at gimplify.c:465 Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions. Preprocessed source stored into /tmp/ccAzPZP8.out file, please attach this to your bugreport. make: *** [main] Error 1
Removing -fopenmp resolves the problem. That piece of information should be helpful in solving the bug.
src/stinger-utils.c:440:7: warning: ISO C forbids nested functions [-pedantic] so the testcase is probably out-of-scope for OpenMP. Didn't ever work, so no regression.
Reduced testcase: stinger_to_sorted_csr ( const int nv ) { int * vtxids; int i; #pragma omp parallel for for (i = 0; i < nv; ++i) { int i64cmp_local (const int *ap) { return ap - vtxids; } f (&vtxids[i], i64cmp_local); } }
This used to work in 4.3.5. The reason why it worked there is because __builtin_adjust_trampoline is outside of the "#pragma omp".
Created attachment 26957 [details] gcc47-pr52547.patch Untested fix. Note the nested fn in OpenMP is only barely supported, it will very likely not do what you expect (the nested function will be accessing the copy of the variables of the function, not the possibly privatized copies of the omp region (as if all the vars were shared), and e.g. non-local gotos in them will not even compile.
Author: jakub Date: Thu Mar 22 19:25:36 2012 New Revision: 185707 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185707 Log: PR middle-end/52547 * tree-nested.c (convert_tramp_reference_stmt): Call declare_vars on any new_local_var_chain vars declared during recursing on GIMPLE_OMP_PARALLEL or GIMPLE_OMP_TASK body. * testsuite/libgomp.c/pr52547.c: New test. Added: trunk/libgomp/testsuite/libgomp.c/pr52547.c Modified: trunk/gcc/ChangeLog trunk/gcc/tree-nested.c trunk/libgomp/ChangeLog
Author: jakub Date: Thu Mar 22 19:27:52 2012 New Revision: 185708 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185708 Log: PR middle-end/52547 * tree-nested.c (convert_tramp_reference_stmt): Call declare_vars on any new_local_var_chain vars declared during recursing on GIMPLE_OMP_PARALLEL or GIMPLE_OMP_TASK body. * testsuite/libgomp.c/pr52547.c: New test. Added: branches/gcc-4_7-branch/libgomp/testsuite/libgomp.c/pr52547.c Modified: branches/gcc-4_7-branch/gcc/ChangeLog branches/gcc-4_7-branch/gcc/tree-nested.c branches/gcc-4_7-branch/libgomp/ChangeLog
Fixed for 4.7.1+ so far.
The 4.5 branch is being closed, adjusting target milestone.
Author: jakub Date: Wed Apr 3 17:52:33 2013 New Revision: 197441 URL: http://gcc.gnu.org/viewcvs?rev=197441&root=gcc&view=rev Log: Backported from mainline 2012-03-22 Jakub Jelinek <jakub@redhat.com> PR middle-end/52547 * tree-nested.c (convert_tramp_reference_stmt): Call declare_vars on any new_local_var_chain vars declared during recursing on GIMPLE_OMP_PARALLEL or GIMPLE_OMP_TASK body. * testsuite/libgomp.c/pr52547.c: New test. Added: branches/gcc-4_6-branch/libgomp/testsuite/libgomp.c/pr52547.c Modified: branches/gcc-4_6-branch/gcc/ChangeLog branches/gcc-4_6-branch/gcc/tree-nested.c branches/gcc-4_6-branch/libgomp/ChangeLog