* [Bug fortran/22290] Optimize Assigned GOTO to cause error with -O1 or higher
2005-07-04 8:23 [Bug tree-optimization/22290] New: Optimize Assigned GOTO to cause error with -O1 or higher fengwang at gcc dot gnu dot org
@ 2005-07-04 10:00 ` pinskia at gcc dot gnu dot org
2005-07-04 12:38 ` fengwang at gcc dot gnu dot org
` (7 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-04 10:00 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-07-04 10:00 -------
Confirmed, This is a fortran front-end or gimplifier bug.
Look at what the gimplifier produces:
int4 nz.0 = -2; // <--- this is not gimple
nz.0 = -1;
nz.1 = &__label_000093;
D.475 = nz.0 != -1;
D.476 = __builtin_expect (D.475, 0);
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Component|tree-optimization |fortran
Ever Confirmed| |1
Keywords| |wrong-code
Last reconfirmed|0000-00-00 00:00:00 |2005-07-04 10:00:04
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22290
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/22290] Optimize Assigned GOTO to cause error with -O1 or higher
2005-07-04 8:23 [Bug tree-optimization/22290] New: Optimize Assigned GOTO to cause error with -O1 or higher fengwang at gcc dot gnu dot org
2005-07-04 10:00 ` [Bug fortran/22290] " pinskia at gcc dot gnu dot org
@ 2005-07-04 12:38 ` fengwang at gcc dot gnu dot org
2005-07-04 15:28 ` steven at gcc dot gnu dot org
` (6 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: fengwang at gcc dot gnu dot org @ 2005-07-04 12:38 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From fengwang at gcc dot gnu dot org 2005-07-04 12:38 -------
(In reply to comment #1)
> Confirmed, This is a fortran front-end or gimplifier bug.
> Look at what the gimplifier produces:
> int4 nz.0 = -2; // <--- this is not gimple
I am not very clear the gimple definition. Can you explain more?
This is the initialization of nz.0 variable. I use this variable to indicate
the integer is assigned a format label (-1) or target label (now it is the
length of format string). See fortran/trans-decl.c (gfc_get_symbol_decl): 815
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22290
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/22290] Optimize Assigned GOTO to cause error with -O1 or higher
2005-07-04 8:23 [Bug tree-optimization/22290] New: Optimize Assigned GOTO to cause error with -O1 or higher fengwang at gcc dot gnu dot org
2005-07-04 10:00 ` [Bug fortran/22290] " pinskia at gcc dot gnu dot org
2005-07-04 12:38 ` fengwang at gcc dot gnu dot org
@ 2005-07-04 15:28 ` steven at gcc dot gnu dot org
2005-07-05 8:39 ` fengwang at gcc dot gnu dot org
` (5 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-07-04 15:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2005-07-04 15:28 -------
"int4 nz.0 = -2;" look line an INIT_EXPR. It should be
"int4 nz.0;
nz.0 = -2"
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22290
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/22290] Optimize Assigned GOTO to cause error with -O1 or higher
2005-07-04 8:23 [Bug tree-optimization/22290] New: Optimize Assigned GOTO to cause error with -O1 or higher fengwang at gcc dot gnu dot org
` (2 preceding siblings ...)
2005-07-04 15:28 ` steven at gcc dot gnu dot org
@ 2005-07-05 8:39 ` fengwang at gcc dot gnu dot org
2005-07-05 8:44 ` fengwang at gcc dot gnu dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: fengwang at gcc dot gnu dot org @ 2005-07-05 8:39 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From fengwang at gcc dot gnu dot org 2005-07-05 08:39 -------
(In reply to comment #3)
> "int4 nz.0 = -2;" look line an INIT_EXPR. It should be
>
> "int4 nz.0;
> nz.0 = -2"
Shall we add an assignment explicitly? Just give an initial value. I don't
think we should defer doing this when generate function codes.
And another question, all the variables which have initial values are treat as
static. Is this reasonable?
Back to this topic, in fact, the error is not caused by nz.0. It is used to
judge if we assign a target label. And the output is "Assigned label is not in
the list". So it has passed the judgement of nz.0.
>From the trees dumped, I found the CCP pass is wrong:
$cat as.f.t22.ccp
;; Function MAIN__ (MAIN__)
Removing basic block 3
Merging blocks 2 and 4
Merging blocks 2 and 5
MAIN__ ()
{
void * gotovar.2;
void * nz.1;
int4 nz.0 = -2;
int4 nz;
<unnamed type> D.476;
logical4 D.475;
<bb 0>:
nz.0_1 = -1;
nz.1_2 = &__label_000093;
D.475_3 = 0;
D.476_4 = 0;
if (D.476_4 != 0) goto <L0>; else goto <L1>;
<L0>:;
_gfortran_runtime_error ("Assigned label is not a target label", "as.f", 2);
__label_000093:; <<<<<<<<<<<<<<<<<<<< Wrong here.
<L1>:;
_gfortran_runtime_error ("Assigned label is not in the list", "as.f", 2
return;
}
Before this pass, it it correct.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22290
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/22290] Optimize Assigned GOTO to cause error with -O1 or higher
2005-07-04 8:23 [Bug tree-optimization/22290] New: Optimize Assigned GOTO to cause error with -O1 or higher fengwang at gcc dot gnu dot org
` (3 preceding siblings ...)
2005-07-05 8:39 ` fengwang at gcc dot gnu dot org
@ 2005-07-05 8:44 ` fengwang at gcc dot gnu dot org
2005-07-06 7:42 ` fengwang at gcc dot gnu dot org
` (3 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: fengwang at gcc dot gnu dot org @ 2005-07-05 8:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From fengwang at gcc dot gnu dot org 2005-07-05 08:44 -------
>From as.f.t22.ccp:
<bb 0>:
nz.0_1 = -1;
nz.1_2 = &__label_000093;
D.475_3 = 0;
D.476_4 = 0;
if (D.476_4 != 0) goto <L0>; else goto <L1>;
This is also wrong.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22290
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/22290] Optimize Assigned GOTO to cause error with -O1 or higher
2005-07-04 8:23 [Bug tree-optimization/22290] New: Optimize Assigned GOTO to cause error with -O1 or higher fengwang at gcc dot gnu dot org
` (4 preceding siblings ...)
2005-07-05 8:44 ` fengwang at gcc dot gnu dot org
@ 2005-07-06 7:42 ` fengwang at gcc dot gnu dot org
2005-07-07 22:16 ` tkoenig at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: fengwang at gcc dot gnu dot org @ 2005-07-06 7:42 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From fengwang at gcc dot gnu dot org 2005-07-06 07:42 -------
(In reply to comment #4)
> And another question, all the variables which have initial values are treat
> as static. Is this reasonable?
Yes, this is reasonable. Confirm myself. In section 5.1 (Fortran95, Working
draft J3/97-007R2):
The presence of initialization implies that object-name is saved, except for
an object-name in a named common block or an object-name with the PARAMETER
attribute.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22290
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/22290] Optimize Assigned GOTO to cause error with -O1 or higher
2005-07-04 8:23 [Bug tree-optimization/22290] New: Optimize Assigned GOTO to cause error with -O1 or higher fengwang at gcc dot gnu dot org
` (5 preceding siblings ...)
2005-07-06 7:42 ` fengwang at gcc dot gnu dot org
@ 2005-07-07 22:16 ` tkoenig at gcc dot gnu dot org
2005-09-13 10:27 ` steven at gcc dot gnu dot org
2005-09-13 14:53 ` fengwang at gcc dot gnu dot org
8 siblings, 0 replies; 14+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2005-07-07 22:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From tkoenig at gcc dot gnu dot org 2005-07-07 22:16 -------
g77 gets this right.
--
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO| |19292
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22290
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/22290] Optimize Assigned GOTO to cause error with -O1 or higher
2005-07-04 8:23 [Bug tree-optimization/22290] New: Optimize Assigned GOTO to cause error with -O1 or higher fengwang at gcc dot gnu dot org
` (6 preceding siblings ...)
2005-07-07 22:16 ` tkoenig at gcc dot gnu dot org
@ 2005-09-13 10:27 ` steven at gcc dot gnu dot org
2005-09-13 14:53 ` fengwang at gcc dot gnu dot org
8 siblings, 0 replies; 14+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-09-13 10:27 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2005-09-13 10:27 -------
Bloody hell. Stupid bug.
Alright then, let's see if I can fix this one.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |steven at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2005-07-04 10:00:04 |2005-09-13 10:27:12
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22290
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/22290] Optimize Assigned GOTO to cause error with -O1 or higher
2005-07-04 8:23 [Bug tree-optimization/22290] New: Optimize Assigned GOTO to cause error with -O1 or higher fengwang at gcc dot gnu dot org
` (7 preceding siblings ...)
2005-09-13 10:27 ` steven at gcc dot gnu dot org
@ 2005-09-13 14:53 ` fengwang at gcc dot gnu dot org
8 siblings, 0 replies; 14+ messages in thread
From: fengwang at gcc dot gnu dot org @ 2005-09-13 14:53 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From fengwang at gcc dot gnu dot org 2005-09-13 14:53 -------
(In reply to comment #8)
> Bloody hell. Stupid bug.
> Alright then, let's see if I can fix this one.
Steven, it seems to disappear on current gcc4.1 and gcc4.0. I once send you a
patch to fix the gimple problem. The patch is attached. And this patch fixes
another compiling ICE in the test case:
subroutine s1 (a)
integer a
assign 777 to a
go to a
777 print *, "Hello s1"
end
program test
call s1 (1)
end
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22290
^ permalink raw reply [flat|nested] 14+ messages in thread