Bug 25990 - gomp ICE with -fopenmp
Summary: gomp ICE with -fopenmp
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: ---
Assignee: Diego Novillo
URL:
Keywords: GC, ice-on-valid-code, monitored, openmp
Depends on:
Blocks:
 
Reported: 2006-01-27 07:33 UTC by perrin
Modified: 2006-02-02 12:37 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-02-01 22:36:04


Attachments
fails with -fopenmp and -O2 (10.82 KB, text/plain)
2006-01-27 07:35 UTC, perrin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description perrin 2006-01-27 07:33:51 UTC
The attached code ICE's with -fopenmp and -O2, but not with just -fopenmp

I build both the recent trunk (svn 110282) and the gomp branch, and it ICE's with both. 

/home/perrin/GOMP/INSTALL/110296/bin/gcc -Wall -std=c99 -v --save-temps -O2  -fopenmp    -m64 -o test_gomp_2 test_gomp_2.c
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: /home/perrin/GOMP/gomp-20050608-branch/configure --prefix=/home/perrin/GOMP/INSTALL/110296/ --enable-threads=posix --enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.2.0-gomp-20050608-branch 20060126 (experimental) (merged 20060126)
 /home/perrin/GOMP/INSTALL/110296/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.2.0-gomp-20050608-branch/cc1 -E -quiet -v -iprefix /home/perrin/GOMP/INSTALL/110296/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.0-gomp-20050608-branch/ -D_REENTRANT test_gomp_2.c -m64 -mtune=generic -std=c99 -Wall -fopenmp -O2 -fpch-preprocess -o test_gomp_2.i
ignoring nonexistent directory "/home/perrin/GOMP/INSTALL/110296/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.0-gomp-20050608-branch/../../../../x86_64-unknown-linux-gnu/include"
ignoring duplicate directory "/home/perrin/GOMP/INSTALL/110296//lib/gcc/x86_64-unknown-linux-gnu/4.2.0-gomp-20050608-branch/include"
ignoring nonexistent directory "/home/perrin/GOMP/INSTALL/110296//lib/gcc/x86_64-unknown-linux-gnu/4.2.0-gomp-20050608-branch/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/perrin/GOMP/INSTALL/110296/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.0-gomp-20050608-branch/include
 /usr/local/include
 /home/perrin/GOMP/INSTALL/110296//include
 /usr/include
End of search list.
 /home/perrin/GOMP/INSTALL/110296/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.2.0-gomp-20050608-branch/cc1 -fpreprocessed test_gomp_2.i -quiet -dumpbase test_gomp_2.c -m64 -mtune=generic -auxbase test_gomp_2 -O2 -Wall -std=c99 -version -fopenmp -o test_gomp_2.s
GNU C version 4.2.0-gomp-20050608-branch 20060126 (experimental) (merged 20060126) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.2.0-gomp-20050608-branch 20060126 (experimental) (merged 20060126).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: b18775707d7fd6662765314b1efc240e
test_gomp_2.c: In function 'main':
test_gomp_2.c:121: warning: unused variable 'HH'
test_gomp_2.c:120: warning: unused variable 'GG'
test_gomp_2.c: In function 'main.omp_fn.1':
test_gomp_2.c:223: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make: *** [test_gomp] Error 1
Comment 1 perrin 2006-01-27 07:35:07 UTC
Created attachment 10740 [details]
fails with -fopenmp and -O2


contains two

#pragama omp parallel for 

loops
Comment 2 Andrew Pinski 2006-01-27 12:58:24 UTC
This is a GC failure:
#0  ggc_set_mark (p=0xafafafafafafafaf) at /home/pinskia/src/checkin/trunk/gcc/ggc-page.c:588
#1  0x0000000000620268 in gt_ggc_mx_basic_block_def (x_p=Variable "x_p" is not available.
) at gtype-desc.c:462
#2  0x000000000062060f in gt_ggc_mx_VEC_basic_block_gc (x_p=Variable "x_p" is not available.
) at gtype-desc.c:193
#3  0x0000000000620673 in gt_ggc_mx_control_flow_graph (x_p=Variable "x_p" is not available.
) at gtype-desc.c:624
#4  0x000000000062072f in gt_ggc_mx_function (x_p=Variable "x_p" is not available.
) at gtype-desc.c:639
#5  0x0000000000409622 in gt_ggc_mx_lang_tree_node (x_p=Variable "x_p" is not available.
) at gt-c-decl.h:315
#6  0x0000000000619df7 in gt_ggc_mx_cgraph_node (x_p=Variable "x_p" is not available.
) at gtype-desc.c:166
#7  0x0000000000619f16 in gt_ggc_m_P11cgraph_node4htab (x_p=Variable "x_p" is not available.
) at gtype-desc.c:1694
Comment 3 Andrew Pinski 2006-01-27 14:09:14 UTC
You can reproduce this with -std=c99 -fopenmp --param ggc-min-expand=0 --param ggc-min-heapsize=0
Comment 4 Andrew Pinski 2006-01-27 14:11:34 UTC
Reducing.
Comment 5 Andrew Pinski 2006-01-27 14:22:50 UTC
Reduced testcase:
__strcspn_c2 (__const char *__s, int __reject1, int __reject2)
{
  int m = 1,n = 1,s = 1;
  int DD,EE,num_s;
  int m_max = 99;
  int n_max = 00;
  for ( n = 1 ; n <= 99 ; n++ )
    for ( m = 1 ; m <= 99 ; m++ )
      for ( m = 1 ; m <= m_max ; m++)
        for ( s = 1 ; s <= num_s ; s++)
        {
          int liter ;
#pragma omp parallel for private(m,liter,s)
           for ( n = 1 ; n <= n_max ; n++) {}
        }
}
Comment 6 Volker Reichelt 2006-01-27 15:18:15 UTC
Even simpler testcase:

==============================================
void foo()
{
  int i;
  for ( i=0; i<1; i++ ) ;
  for ( i=0; i<1; i++ ) ;
  for ( i=0; i<1; i++ ) ;
  for ( i=0; i<1; i++ ) ;
  for ( i=0; i<1; i++ ) ;
#pragma omp parallel
  ;
}
==============================================
Comment 7 Volker Reichelt 2006-02-01 12:38:38 UTC
Hi Diego,

did you have a look at this one?
This makes -fopenmp almost unusable for the C++ frontend.
PR 26032 is probably a duplicate of this one.
I stumbled over the bug independently, too.
Comment 8 Diego Novillo 2006-02-01 12:56:18 UTC
Mine.
Comment 9 tbp 2006-02-01 14:28:52 UTC
And you can add PR 25983 on top of it :)
Comment 10 Diego Novillo 2006-02-01 16:05:29 UTC
I can't reproduced this with trunk@110474 nor gomp@110467.  Could you please try again?
Comment 11 Volker Reichelt 2006-02-01 16:19:56 UTC
I still get a segfault for the testcase in comment #6.
This is revision 110467 on x86_64-unknown-linux-gnu.
Note, that this is with the C frontend:

gcc -fopenmp --param ggc-min-expand=0 --param ggc-min-heapsize=0 -c PR25990.c
Comment 12 Andrew Pinski 2006-02-01 18:06:32 UTC
I can still confirm it too.
Comment 13 Diego Novillo 2006-02-01 22:36:04 UTC
(In reply to comment #11)
> I still get a segfault for the testcase in comment #6.
> This is revision 110467 on x86_64-unknown-linux-gnu.
>
Ah, yes.  I had failed to notice the failure is on x86_64.  Sorry about that.
Comment 14 Diego Novillo 2006-02-02 12:27:07 UTC
Subject: Bug 25990

Author: dnovillo
Date: Thu Feb  2 12:27:02 2006
New Revision: 110511

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110511
Log:

	PR 25990
	* tree-cfg.c (move_block_to_fn): Clear out the basic block
	array after growing it.

testsuite/

	PR 25990
	* gcc.dg/gomp/pr25990.c: New test.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-cfg.c

Comment 15 Diego Novillo 2006-02-02 12:37:16 UTC
Fixed.  http://gcc.gnu.org/ml/gcc-patches/2006-02/msg00121.html