public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/33348]  New: [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -O1
@ 2007-09-08  0:52 pinskia at gcc dot gnu dot org
  2007-09-08  0:52 ` [Bug middle-end/33348] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-09-08  0:52 UTC (permalink / raw)
  To: gcc-bugs

+FAIL: gfortran.dg/g77/19990826-3.f  -O  (internal compiler error)
+FAIL: gfortran.dg/g77/19990826-3.f  -O  (test for excess errors)

This showed up between revision 128118 and 128143.

/home/apinski/src/local/gcc/gcc/testsuite/gfortran.dg/g77/19990826-3.f:319:
error: invalid rtl sharing found in the insn
/home/apinski/src/local/gcc/gcc/testsuite/gfortran.dg/g77/19990826-3.f:319:
error: shared rtx
(mem/c/i:SI (plus:DI (reg/f:DI 113 sfp)
                     (const_int 244 [0xf4])) [0 S4 A32])


-- 
           Summary: [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -
                    O1
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
GCC target triplet: powerpc64-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33348


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/33348] [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -O1
  2007-09-08  0:52 [Bug middle-end/33348] New: [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -O1 pinskia at gcc dot gnu dot org
@ 2007-09-08  0:52 ` pinskia at gcc dot gnu dot org
  2007-09-15 19:47 ` dominiq at lps dot ens dot fr
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-09-08  0:52 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33348


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/33348] [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -O1
  2007-09-08  0:52 [Bug middle-end/33348] New: [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -O1 pinskia at gcc dot gnu dot org
  2007-09-08  0:52 ` [Bug middle-end/33348] " pinskia at gcc dot gnu dot org
@ 2007-09-15 19:47 ` dominiq at lps dot ens dot fr
  2007-09-15 20:28 ` dominiq at lps dot ens dot fr
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dominiq at lps dot ens dot fr @ 2007-09-15 19:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dominiq at lps dot ens dot fr  2007-09-15 19:47 -------
I have reduced the test to:

C* PCAPOP
      SUBROUTINE PCAPOP()
      DIMENSION NVA(6)
C
!      P1=FLOAT(NB)/FLOAT(M1)
10    IP1=P1
      IF(IP1.GE.NVA(K)) GOTO 7
      IF(IP2.EQ.0) GOTO 3
7     IF(K.EQ.6) GOTO 11
      GOTO 10
11    IP1=0
3     CONTINUE
      END

It gives slightly different failures at -O1:

19990826-3_red.f: In function 'pcapop':
19990826-3_red.f:12: error: invalid rtl sharing found in the insn
(insn 42 41 43 2 19990826-3_red.f:7 (set (reg:SI 136)
        (mem/c/i:SI (plus:SI (reg/f:SI 113 sfp)
                (const_int 60 [0x3c])) [0 S4 A32])) 328 {*movsi_internal1}
(expr_list:REG_EQUAL (fix:SI (reg:DF 134))
        (nil)))
19990826-3_red.f:12: error: shared rtx
(mem/c/i:SI (plus:SI (reg/f:SI 113 sfp)
        (const_int 60 [0x3c])) [0 S4 A32])
19990826-3_red.f:12: internal compiler error: internal consistency failure
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

-O2:

19990826-3_red.f: In function 'pcapop':
19990826-3_red.f:12: error: invalid rtl sharing found in the insn
(insn 44 43 45 2 (set (reg:SI 136)
        (mem/c/i:SI (plus:SI (reg/f:SI 113 sfp)
                (const_int 60 [0x3c])) [3 S4 A32])) 328 {*movsi_internal1}
(expr_list:REG_EQUAL (fix:SI (reg:DF 134))
        (nil)))
19990826-3_red.f:12: error: shared rtx
(mem/c/i:SI (plus:SI (reg/f:SI 113 sfp)
        (const_int 60 [0x3c])) [3 S4 A32])
19990826-3_red.f:12: internal compiler error: internal consistency failure
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

and -Os:

19990826-3_red.f: In function 'pcapop':
19990826-3_red.f:12: error: invalid rtl sharing found in the insn
(insn 43 42 44 2 19990826-3_red.f:7 (set (reg:SI 136)
        (mem/c/i:SI (plus:SI (reg/f:SI 113 sfp)
                (const_int 60 [0x3c])) [3 S4 A32])) 328 {*movsi_internal1}
(expr_list:REG_EQUAL (fix:SI (reg:DF 134))
        (nil)))
19990826-3_red.f:12: error: shared rtx
(mem/c/i:SI (plus:SI (reg/f:SI 113 sfp)
        (const_int 60 [0x3c])) [3 S4 A32])
19990826-3_red.f:12: internal compiler error: internal consistency failure
Please submit a full bug report,
with preprocessed source if appropriate.

but compiles at -O0 and -O3.

Now the strange thing is that if I uncomment the line:

!      P1=FLOAT(NB)/FLOAT(M1)

it fails only at -O1 and -Os:

[karma] f90/bug% gfc -c -O0 19990826-3_red.f
[karma] f90/bug% gfc -c -Os 19990826-3_red.f
19990826-3_red.f: In function 'pcapop':
19990826-3_red.f:12: error: invalid rtl sharing found in the insn
(insn 60 59 61 2 19990826-3_red.f:7 (set (reg:SI 156)
        (mem/c/i:SI (plus:SI (reg/f:SI 113 sfp)
                (const_int 76 [0x4c])) [3 S4 A32])) 328 {*movsi_internal1}
(expr_list:REG_EQUAL (fix:SI (reg:DF 154))
        (nil)))
19990826-3_red.f:12: error: shared rtx
(mem/c/i:SI (plus:SI (reg/f:SI 113 sfp)
        (const_int 76 [0x4c])) [3 S4 A32])
19990826-3_red.f:12: internal compiler error: internal consistency failure
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
[karma] f90/bug% gfc -c -O3 19990826-3_red.f
[karma] f90/bug% gfc -c -O2 19990826-3_red.f
[karma] f90/bug% gfc -c -O1 19990826-3_red.f
19990826-3_red.f: In function 'pcapop':
19990826-3_red.f:12: error: invalid rtl sharing found in the insn
(insn 59 58 60 2 19990826-3_red.f:7 (set (reg:SI 156)
        (mem/c/i:SI (plus:SI (reg/f:SI 113 sfp)
                (const_int 76 [0x4c])) [0 S4 A32])) 328 {*movsi_internal1}
(expr_list:REG_EQUAL (fix:SI (reg:DF 154))
        (nil)))
19990826-3_red.f:12: error: shared rtx
(mem/c/i:SI (plus:SI (reg/f:SI 113 sfp)
        (const_int 76 [0x4c])) [0 S4 A32])
19990826-3_red.f:12: internal compiler error: internal consistency failure
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

I did not succeeded to further simplify the spaghetti code while keeping the
failure(s).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33348


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/33348] [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -O1
  2007-09-08  0:52 [Bug middle-end/33348] New: [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -O1 pinskia at gcc dot gnu dot org
  2007-09-08  0:52 ` [Bug middle-end/33348] " pinskia at gcc dot gnu dot org
  2007-09-15 19:47 ` dominiq at lps dot ens dot fr
@ 2007-09-15 20:28 ` dominiq at lps dot ens dot fr
  2007-09-16 21:52 ` hubicka at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dominiq at lps dot ens dot fr @ 2007-09-15 20:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dominiq at lps dot ens dot fr  2007-09-15 20:28 -------
The line

      SUBROUTINE PCAPOP()

is not necessary to get the failure.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33348


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/33348] [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -O1
  2007-09-08  0:52 [Bug middle-end/33348] New: [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -O1 pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-09-15 20:28 ` dominiq at lps dot ens dot fr
@ 2007-09-16 21:52 ` hubicka at gcc dot gnu dot org
  2007-09-16 22:07 ` rakdver at kam dot mff dot cuni dot cz
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hubicka at gcc dot gnu dot org @ 2007-09-16 21:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from hubicka at gcc dot gnu dot org  2007-09-16 21:52 -------
What happens in this testcase is (mis)behaviour of invariant code motion.
On instruction:
(set (mem/c/i:SI (plus:DI (reg/f:DI 113 sfp)
            (const_int 80 [0x50])) [3 S4 A32])
    (fix:SI (reg:DF 135)))

the invariant code is trying to replace the write->load pair, however the
truncsfdf2 expander is expanding fix from reg to reg will offload the value to
memory again, so we are replacing load by:

(insn 44 0 45 (parallel [
            (set (mem/c/i:SI (plus:DI (reg/f:DI 113 sfp)
                        (const_int 84 [0x54])) [3 S4 A32])
                (fix:SI (reg:DF 135)))
            (clobber (reg:DI 138))
        ]) -1 (nil))

(insn 45 44 46 (set (reg:SI 137)
        (mem/c/i:SI (plus:DI (reg/f:DI 113 sfp)
                (const_int 84 [0x54])) [3 S4 A32])) -1 (expr_list:REG_EQUAL
(fix:SI (reg:DF 135))
        (nil)))

(insn 46 45 0 (set (reg:SI 136)
        (reg:SI 137)) -1 (nil))

This is not very sane transformation at all IMO.  Zdenek, perhaps we can
disable the transform, when force_operand produces a memory load or some
similar lame trick?

Anyway, the sharing problem is cured by:
Index: loop-invariant.c
===================================================================
*** loop-invariant.c    (revision 128492)
--- loop-invariant.c    (working copy)
*************** move_invariant_reg (struct loop *loop, u
*** 1243,1248 ****
--- 1243,1249 ----
          if (op != reg)
            emit_move_insn (reg, op);
          seq = get_insns ();
+         unshare_all_rtl_in_chain (seq);
          end_sequence ();

          if (!seq_insns_valid_p (seq))

I will commit as obvious if testing passes. Still I would hope we can also
avoid loop from doing this transform at all.

Honza


-- 

hubicka at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rakdver at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-09-16 21:52:08
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33348


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/33348] [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -O1
  2007-09-08  0:52 [Bug middle-end/33348] New: [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -O1 pinskia at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-09-16 21:52 ` hubicka at gcc dot gnu dot org
@ 2007-09-16 22:07 ` rakdver at kam dot mff dot cuni dot cz
  2007-09-17 14:53 ` howarth at nitro dot med dot uc dot edu
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rakdver at kam dot mff dot cuni dot cz @ 2007-09-16 22:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rakdver at kam dot mff dot cuni dot cz  2007-09-16 22:07 -------
Subject: Re:  [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -O1

> What happens in this testcase is (mis)behaviour of invariant code motion.
> On instruction:
> (set (mem/c/i:SI (plus:DI (reg/f:DI 113 sfp)
>             (const_int 80 [0x50])) [3 S4 A32])
>     (fix:SI (reg:DF 135)))
> 
> the invariant code is trying to replace the write->load pair, however the
> truncsfdf2 expander is expanding fix from reg to reg will offload the value to
> memory again, so we are replacing load by:
> 
> (insn 44 0 45 (parallel [
>             (set (mem/c/i:SI (plus:DI (reg/f:DI 113 sfp)
>                         (const_int 84 [0x54])) [3 S4 A32])
>                 (fix:SI (reg:DF 135)))
>             (clobber (reg:DI 138))
>         ]) -1 (nil))
> 
> (insn 45 44 46 (set (reg:SI 137)
>         (mem/c/i:SI (plus:DI (reg/f:DI 113 sfp)
>                 (const_int 84 [0x54])) [3 S4 A32])) -1 (expr_list:REG_EQUAL
> (fix:SI (reg:DF 135))
>         (nil)))
> 
> (insn 46 45 0 (set (reg:SI 136)
>         (reg:SI 137)) -1 (nil))
> 
> This is not very sane transformation at all IMO.

Actually, it may make some sense -- the newly generated memory store &
load are outside of the loop; so the code inside the loop is simplified,
and in some cases we might even avoid memory accesses inside the loop.
Nevertheless, force_operand in move_invariant_reg causes other problems
as well, so I guess I will remove this code.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33348


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/33348] [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -O1
  2007-09-08  0:52 [Bug middle-end/33348] New: [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -O1 pinskia at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-09-16 22:07 ` rakdver at kam dot mff dot cuni dot cz
@ 2007-09-17 14:53 ` howarth at nitro dot med dot uc dot edu
  2007-09-17 14:57 ` howarth at nitro dot med dot uc dot edu
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: howarth at nitro dot med dot uc dot edu @ 2007-09-17 14:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from howarth at nitro dot med dot uc dot edu  2007-09-17 14:52 -------
On powerpc-apple-darwin9, the patch Zdenek is checking in...

http://gcc.gnu.org/ml/gcc-patches/2007-09/msg01380.html

suppresses the build problems in Java...

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33406

on powerpc-apple-darwin9. Zdenek thought your patch was the true fix
to the Java build problem and its suppression with his patch was a 
side-effect. Honza, you might want to get you changes in before
Zdenek checks in just in case it suppresses this PR as well (making
it impossible to test).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33348


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/33348] [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -O1
  2007-09-08  0:52 [Bug middle-end/33348] New: [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -O1 pinskia at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-09-17 14:53 ` howarth at nitro dot med dot uc dot edu
@ 2007-09-17 14:57 ` howarth at nitro dot med dot uc dot edu
  2007-09-17 15:12 ` hubicka at gcc dot gnu dot org
  2007-09-19 18:08 ` andreast at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: howarth at nitro dot med dot uc dot edu @ 2007-09-17 14:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from howarth at nitro dot med dot uc dot edu  2007-09-17 14:57 -------
To clarify, what I meant to say in the above comment was that I am concerned if
Zdenek's patch may convert this PR into a latent bug.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33348


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/33348] [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -O1
  2007-09-08  0:52 [Bug middle-end/33348] New: [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -O1 pinskia at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2007-09-17 14:57 ` howarth at nitro dot med dot uc dot edu
@ 2007-09-17 15:12 ` hubicka at gcc dot gnu dot org
  2007-09-19 18:08 ` andreast at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: hubicka at gcc dot gnu dot org @ 2007-09-17 15:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from hubicka at gcc dot gnu dot org  2007-09-17 15:12 -------
Subject: Bug 33348

Author: hubicka
Date: Mon Sep 17 15:12:10 2007
New Revision: 128547

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128547
Log:
        PR middle-end/33348
        PR target/33406
        * loop-invariant.c (move_invariant_reg): Unshare sequence.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/loop-invariant.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33348


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/33348] [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -O1
  2007-09-08  0:52 [Bug middle-end/33348] New: [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -O1 pinskia at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2007-09-17 15:12 ` hubicka at gcc dot gnu dot org
@ 2007-09-19 18:08 ` andreast at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: andreast at gcc dot gnu dot org @ 2007-09-19 18:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from andreast at gcc dot gnu dot org  2007-09-19 18:08 -------
Fixed


-- 

andreast at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33348


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-09-19 18:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-08  0:52 [Bug middle-end/33348] New: [4.3 Regression] gfortran.dg/g77/19990826-3.f fails at -O1 pinskia at gcc dot gnu dot org
2007-09-08  0:52 ` [Bug middle-end/33348] " pinskia at gcc dot gnu dot org
2007-09-15 19:47 ` dominiq at lps dot ens dot fr
2007-09-15 20:28 ` dominiq at lps dot ens dot fr
2007-09-16 21:52 ` hubicka at gcc dot gnu dot org
2007-09-16 22:07 ` rakdver at kam dot mff dot cuni dot cz
2007-09-17 14:53 ` howarth at nitro dot med dot uc dot edu
2007-09-17 14:57 ` howarth at nitro dot med dot uc dot edu
2007-09-17 15:12 ` hubicka at gcc dot gnu dot org
2007-09-19 18:08 ` andreast at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).