public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "linkw at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/111427] [14 regression] gfortran.dg/vect/pr60510.f fails after r14-3999-g3c834d85f2ec42
Date: Tue, 26 Sep 2023 06:13:14 +0000	[thread overview]
Message-ID: <bug-111427-4-szQlxstMRE@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111427-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111427

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-09-26
           Keywords|ra, wrong-code              |testsuite-fail
           Assignee|unassigned at gcc dot gnu.org      |linkw at gcc dot gnu.org
                 CC|                            |linkw at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #2 from Kewen Lin <linkw at gcc dot gnu.org> ---
I found it can be reproduced on Power8 but not on Power9 (BE since only BE
supports -m32).

The option can be reduced to:

opts="-m32 -funroll-loops -O2 -mcpu=power8"

Looking into the affected test case, IMHO this is a test issue:

      subroutine foo(a,x,y,n)
      implicit none
      integer n,i

      real*8 y(n),x(n),a

      do i=1,n
         a=a+x(i)*y(i)+x(i)
      enddo

      return
      end

      program test
      real*8 x(1024),y(1024),a    ===> line A
      do i=1,1024
        x(i) = i
        y(i) = i+1
      enddo
      call foo(a,x,y,1024)
      if (a.ne.359488000.0) STOP 1
      end

The variable a in line A is an uninitialized variable.

Without the culprit commit, the address of the passed a is 0xfffeec30:

Dump of assembler code for function MAIN__:
   0x100008b0 <+0>:     stwu    r1,-16416(r1)
   ...
   0x100009f4 <+324>:   lis     r12,4096
   0x100009f8 <+328>:   addi    r5,r1,16
   0x100009fc <+332>:   addi    r4,r1,8208
   0x10000a00 <+336>:   addi    r3,r1,16400
   0x10000a04 <+340>:   addi    r6,r12,3160
=> 0x10000a08 <+344>:   bl      0x10000620 <foo_>

(gdb) i r r3
r3             0xfffeec30          4294896688
(gdb) x /2x 0xfffeec30
0xfffeec30:     0x10000524      0x00000000

the random value of "a" is 0x1000052400000000, a tiny float value
(1.289846527864432e-231) and doesn't cause the comparison to fail.

With the culprit commit, the address of the passed a is 0xfffeec20:

100008b0 <MAIN__>:
100008b0:       94 21 bf d0     stwu    r1,-16432(r1)
100008b4:       3d 20 10 00     lis     r9,4096
...

(gdb) x /2x 0xfffeec20
0xfffeec20:     0xfffeec40      0x0fddd03c
(gdb) i r r3
r3             0xfffeec20          4294896672

the random value of "a" is 0xfffeec400fddd03c, which is NAN, so it causes the
comparison to fail.

I'm not sure why this doesn't get exposed before (so lucky), but an explicit
initialization for a should fix this.

  parent reply	other threads:[~2023-09-26  6:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15 20:17 [Bug other/111427] New: " seurer at gcc dot gnu.org
2023-09-17 19:30 ` [Bug middle-end/111427] " pinskia at gcc dot gnu.org
2023-09-22 19:15 ` vmakarov at gcc dot gnu.org
2023-09-26  6:13 ` linkw at gcc dot gnu.org [this message]
2023-09-29 19:59 ` [Bug testsuite/111427] " vmakarov at gcc dot gnu.org
2023-10-12  5:06 ` cvs-commit at gcc dot gnu.org
2023-10-12  5:12 ` linkw at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-111427-4-szQlxstMRE@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).