This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR fortran/68283 -- remove a rogue gfc_internal_error()
- From: Thomas Koenig <tkoenig at netcologne dot de>
- To: Dominique d'HumiÃres <dominiq at lps dot ens dot fr>, Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- Cc: jvdelisle at charter dot net, tkoenig at gcc dot gnu dot org, Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>, fortran at gcc dot gnu dot org, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 14 Nov 2015 16:30:25 +0100
- Subject: Re: [PATCH] PR fortran/68283 -- remove a rogue gfc_internal_error()
- Authentication-results: sourceware.org; auth=none
- References: <A668E856-03F8-449C-B658-3726F904A156 at lps dot ens dot fr>
Hi Dominique,
(1) Why is this block reached when compiling with -ffrontend-optimize, but not with -fno-frontend-optimize (Thomas)?
The problem here is that gfc_variable_attr is called (indirectly)
during optimize_assignment. In this case, this causes the ICE
because of the existing error condition.
Here is the backtrace:
#0 gfc_internal_error (gmsgid=gmsgid@entry=0x14e4170
"gfc_variable_attr(): Bad array reference") at
../../trunk/gcc/fortran/error.c:1288
#1 0x000000000069f15a in gfc_variable_attr (expr=<optimized out>,
ts=ts@entry=0x0) at ../../trunk/gcc/fortran/primary.c:2272
#2 0x000000000069f180 in gfc_expr_attr (e=e@entry=0x2162d20) at
../../trunk/gcc/fortran/primary.c:2351
#3 0x00000000006d50de in gfc_check_dependency (expr1=0x2162990,
expr2=0x2162d20, identical=<optimized out>) at
../../trunk/gcc/fortran/dependency.c:1292
#4 0x00000000006d5043 in gfc_check_dependency (expr1=0x2162990,
expr2=0x20da550, identical=true) at
../../trunk/gcc/fortran/dependency.c:1260
#5 0x0000000000770f8c in optimize_assignment (c=0x20da730) at
../../trunk/gcc/fortran/frontend-passes.c:1162
#6 optimize_code (c=<optimized out>, walk_subtrees=<optimized out>,
data=<optimized out>) at ../../trunk/gcc/fortran/frontend-passes.c:206
It might be worth not running the optimization when error conditions
exist. I'll think about this.
However, I have no objection to just removing the gfc_internal_error.
Regards
Thomas