Bug 43836 - [4.4 Regression] ice with -fexceptions and -fopenmp
Summary: [4.4 Regression] ice with -fexceptions and -fopenmp
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.4.4
: P3 normal
Target Milestone: 4.4.4
Assignee: Jakub Jelinek
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2010-04-21 15:27 UTC by Joost VandeVondele
Modified: 2010-04-22 09:39 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.3.1 4.5.0
Known to fail: 4.4.1 4.4.2 4.4.4
Last reconfirmed: 2010-04-21 16:56:16


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joost VandeVondele 2010-04-21 15:27:08 UTC
The following causes an ICE:

> cat bug.f90
MODULE dbcsr_work_operations
  TYPE dbcsr_type
  END TYPE dbcsr_type
  TYPE dbcsr_obj
     TYPE(dbcsr_type) :: m
  END TYPE dbcsr_obj
CONTAINS
  SUBROUTINE dbcsr_finalize(matrix)
    TYPE(dbcsr_obj), INTENT(INOUT)           :: matrix
!$omp single
!$omp parallel num_threads(1)
    CALL dbcsr_merge_data (matrix%m, sort_data )
!$omp end parallel
!$omp end single
  END SUBROUTINE dbcsr_finalize
END MODULE dbcsr_work_operations

> gfortran -v -c -O0 -fopenmp -fexceptions bug.f90
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: /data03/vondele/gcc_4_4_branch/gcc/configure --prefix=/data03/vondele/gcc_4_4_branch/build --with-ppl=/data03/vondele/gcc_trunk/build/ --with-cloog=/data03/vondele/gcc_trunk/build/ --enable-languages=c,c++,fortran --disable-multilib
Thread model: posix
gcc version 4.4.4 20100421 (prerelease) [gcc-4_4-branch revision 158605] (GCC)
COLLECT_GCC_OPTIONS='-v' '-c' '-O0' '-fopenmp' '-fexceptions' '-mtune=generic' '-pthread'
 /data03/vondele/gcc_4_4_branch/build/libexec/gcc/x86_64-unknown-linux-gnu/4.4.4/f951 bug.f90 -quiet -dumpbase bug.f90 -mtune=generic -auxbase bug -O0 -version -fopenmp -fexceptions -fintrinsic-modules-path /data03/vondele/gcc_4_4_branch/build/lib/gcc/x86_64-unknown-linux-gnu/4.4.4/finclude -o /tmp/ccff06dK.s
GNU Fortran (GCC) version 4.4.4 20100421 (prerelease) [gcc-4_4-branch revision 158605] (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.4.4 20100421 (prerelease) [gcc-4_4-branch revision 158605], GMP version 4.2.2, MPFR version 2.3.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
bug.f90: In function ‘dbcsr_finalize’:
bug.f90:12: internal compiler error: Segmentation fault
Comment 1 Joost VandeVondele 2010-04-21 15:30:13 UTC
4.3.1 ([gcc-4_3-branch revision 135036]) does not fail, so marking as regression.
4.5.0 works as well

with 4.4.4 I have this backtrace:

(gdb) bt
#0  bitmap_element_allocate (head=0x10284c0) at /data03/vondele/gcc_4_4_branch/gcc/gcc/bitmap.c:206
#1  0x00000000004d076c in bitmap_set_bit (head=0x10284c0, bit=<value optimized out>) at /data03/vondele/gcc_4_4_branch/gcc/gcc/bitmap.c:638
#2  0x00000000009ba0b0 in compute_dominance_frontiers (frontiers=0x1028440) at /data03/vondele/gcc_4_4_branch/gcc/gcc/cfganal.c:1278
#3  0x00000000006d5849 in rewrite_into_ssa () at /data03/vondele/gcc_4_4_branch/gcc/gcc/tree-into-ssa.c:2256
#4  0x00000000006171db in execute_one_pass (pass=0xf795c0) at /data03/vondele/gcc_4_4_branch/gcc/gcc/passes.c:1277
#5  0x0000000000617415 in execute_pass_list (pass=0xf795c0) at /data03/vondele/gcc_4_4_branch/gcc/gcc/passes.c:1326
#6  0x0000000000617735 in execute_ipa_pass_list (pass=0xf79800) at /data03/vondele/gcc_4_4_branch/gcc/gcc/passes.c:890
#7  0x0000000000805301 in cgraph_optimize () at /data03/vondele/gcc_4_4_branch/gcc/gcc/cgraphunit.c:1237
#8  0x0000000000490d6a in gfc_be_parse_file (set_yydebug=<value optimized out>) at /data03/vondele/gcc_4_4_branch/gcc/gcc/fortran/f95-lang.c:240
#9  0x00000000006a7fb4 in toplev_main (argc=<value optimized out>, argv=<value optimized out>) at /data03/vondele/gcc_4_4_branch/gcc/gcc/toplev.c:970
#10 0x00007f91de717436 in __libc_start_main () from /lib64/libc.so.6
#11 0x00000000004061a9 in _start ()
Comment 2 Tobias Burnus 2010-04-21 17:48:18 UTC
See patch at http://gcc.gnu.org/ml/fortran/2010-04/msg00222.html and follow up at PR 43837
Comment 3 Joost VandeVondele 2010-04-21 17:53:43 UTC
(In reply to comment #2)
> See patch at http://gcc.gnu.org/ml/fortran/2010-04/msg00222.html and follow up
> at PR 43837

beats the speed of light... thanks.

A very practical question. Is Fortran code compiled with -fexceptions necessarily miscompiled, or will it behave properly. The reason I'm asking (and found the bug) is that openmpi adds -fexceptions by default via the mpif90 script at compilation time.
Comment 4 Jakub Jelinek 2010-04-21 21:23:09 UTC
Subject: Bug 43836

Author: jakub
Date: Wed Apr 21 21:20:07 2010
New Revision: 158619

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158619
Log:
	PR fortran/43836
	* f95-lang.c (gfc_define_builtin): Set TREE_NOTHROW on
	the decl.

	* gfortran.dg/gomp/pr43836.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/gomp/pr43836.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/f95-lang.c
    trunk/gcc/testsuite/ChangeLog

Comment 5 Jakub Jelinek 2010-04-21 21:26:17 UTC
Subject: Bug 43836

Author: jakub
Date: Wed Apr 21 21:24:04 2010
New Revision: 158620

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158620
Log:
	PR fortran/43836
	* f95-lang.c (gfc_define_builtin): Set TREE_NOTHROW on
	the decl.

	* gfortran.dg/gomp/pr43836.f90: New test.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/gomp/pr43836.f90
Modified:
    branches/gcc-4_5-branch/gcc/fortran/ChangeLog
    branches/gcc-4_5-branch/gcc/fortran/f95-lang.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog

Comment 6 Jakub Jelinek 2010-04-21 21:30:56 UTC
Subject: Bug 43836

Author: jakub
Date: Wed Apr 21 21:26:11 2010
New Revision: 158621

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158621
Log:
	PR fortran/43836
	* f95-lang.c (gfc_define_builtin): Set TREE_NOTHROW on
	the decl.

	* gfortran.dg/gomp/pr43836.f90: New test.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/gomp/pr43836.f90
Modified:
    branches/gcc-4_4-branch/gcc/fortran/ChangeLog
    branches/gcc-4_4-branch/gcc/fortran/f95-lang.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog

Comment 7 Jakub Jelinek 2010-04-22 09:39:49 UTC
Fixed for 4.4.4/4.5.1/4.6.0.