[Bug fortran/84848] [8 Regression] FAIL: gfortran.dg/coarray/event_3.f08 -fcoarray=single -O2 -latomic execution test

2018-03-23 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84848

Jakub Jelinek  changed:

   What|Removed |Added

 Status|WAITING |NEW

--- Comment #6 from Jakub Jelinek  ---
Looking at lock_1.f90 original dump, for type(lock_type) :: lock[*] we are just
declaring a variable that we never actually use, the lock/unlock is optimized
away, so it likely is just event_type that needs special handling, initialize
it somewhere early when translating corresponding namespace with the_var = 0;

[Bug fortran/84848] [8 Regression] FAIL: gfortran.dg/coarray/event_3.f08 -fcoarray=single -O2 -latomic execution test

2018-03-23 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84848

Jakub Jelinek  changed:

   What|Removed |Added

   Priority|P3  |P4

--- Comment #5 from Jakub Jelinek  ---
The *.optimized dump then has:
  struct FRAME.global_event FRAME.1;
  static integer(kind=4) options.0[7] = {68, 8191, 0, 1, 1, 0, 31};
  integer(kind=4) _8;

   [local count: 1073741825]:
  _gfortran_set_args (argc_2(D), argv_3(D));
  _gfortran_set_options (7, [0]);
  _8 = FRAME.1.x;
  if (_8 != 0)
goto ; [0.04%]
  else
goto ; [99.96%]

   [local count: 429497]:
  _gfortran_error_stop_numeric (1, 0);

   [local count: 1073312327]:
  return 0;
where it is more clear that it actually reads an uninitialized variable and
decides based on it if it should stop 1 or not.  Everything else is optimized
away.

[Bug fortran/84848] [8 Regression] FAIL: gfortran.dg/coarray/event_3.f08 -fcoarray=single -O2 -latomic execution test

2018-03-23 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84848

Jakub Jelinek  changed:

   What|Removed |Added

 CC||burnus at gcc dot gnu.org,
   ||jakub at gcc dot gnu.org,
   ||vehre at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek  ---
This sounds like UB (use of uninitialized var), though I know next to nothing
about type(event_type), but looking around I see various examples in Fortran
pdfs that use type(event_type) and never initialize it in any special way.
So, based on that the bug is likely in the -fcoarray=single support of
event_type that we fail to zero initialize the vars we create for it, or, if
some initialization is required from users, in the testcase.

In any case, on x86_64-linux with -fcoarray=single I see in the *.original
dump:
exchange ()
{
  integer(kind=4) cnt;

  (integer(kind=4)) x = (integer(kind=4)) x + 1;
  (integer(kind=4)) x = (integer(kind=4)) x + 1;
  cnt = (integer(kind=4)) x;
  if (cnt != 2)
{
  _gfortran_error_stop_numeric (1, 0);
}
  L.1:;
  (integer(kind=4)) x = (integer(kind=4)) x + -2;
}

(this is fine, it only uses the x from the parent function) and
global_event ()
{
  static void exchange (void);
  integer(kind=4) x;

  exchange ();
}

As x is automatic variable and is not initialized, the x++ statements invoke
(from middle-end POV) UB by incrementing uninitialized variable.

[Bug fortran/84848] [8 Regression] FAIL: gfortran.dg/coarray/event_3.f08 -fcoarray=single -O2 -latomic execution test

2018-03-13 Thread dave.anglin at bell dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84848

--- Comment #3 from dave.anglin at bell dot net ---
On 2018-03-13 10:57 AM, dominiq at lps dot ens.fr wrote:
> WORKSFORME on x86_64-apple-darwin17. A target issue?
I'm not sure how this test is supposed to work:

Breakpoint 3, 0x00010498 in main (argc=, argv=)
     at 
/home/dave/gnu/gcc/gcc/gcc/testsuite/gfortran.dg/coarray/event_3.f08:10
10    call exchange
(gdb) disass
Dump of assembler code for function main:
    0x00010488 <+0>: stw rp,-14(sp)
    0x0001048c <+4>: ldo 40(sp),sp
    0x00010490 <+8>: b,l 0x10448,rp
    0x00010494 <+12>:    nop
=> 0x00010498 <+16>:    ldi 7,r26
    0x0001049c <+20>:    ldil L%10800,r25
    0x000104a0 <+24>:    b,l 0x10458,rp
    0x000104a4 <+28>:    ldo 2ec(r25),r25
    0x000104a8 <+32>:    ldw -38(sp),ret0
    0x000104ac <+36>:    cmpib,<> 0,ret0,0x104c0 
    0x000104b0 <+40>:    ldi 0,ret0
    0x000104b4 <+44>:    ldw -54(sp),rp
    0x000104b8 <+48>:    bv r0(rp)
    0x000104bc <+52>:    ldo -40(sp),sp
    0x000104c0 <+56>:    ldi 0,r25
    0x000104c4 <+60>:    b,l 0x10468,rp
    0x000104c8 <+64>:    ldi 1,r26
    0x000104cc <+68>:    nop
End of assembler dump.
(gdb) x/x $sp - 0x38
0xf8d02308: 0x00130ee8
(gdb) c
Continuing.

Breakpoint 2, 0x000104ac in exchange ()
     at 
/home/dave/gnu/gcc/gcc/gcc/testsuite/gfortran.dg/coarray/event_3.f08:17
17    if (cnt /= 2) error stop 1
(gdb) x/x $sp - 0x38
0xf8d02308: 0x00130ee8
(gdb) p/x $ret0
$1 = 0x130ee8

cnt is a location on the stack but the address of options.0.923 is 
passed in %r25 to _gfortran_set_options.
It looks as if the "call event_query(x, cnt)" line in the test has bee 
optimized away.

[Bug fortran/84848] [8 Regression] FAIL: gfortran.dg/coarray/event_3.f08 -fcoarray=single -O2 -latomic execution test

2018-03-13 Thread dave.anglin at bell dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84848

--- Comment #2 from dave.anglin at bell dot net ---
On 2018-03-13 10:57 AM, dominiq at lps dot ens.fr wrote:
> WORKSFORME on x86_64-apple-darwin17. A target issue?
I see it also occurs on 32-bit hppa-unknown-linux-gnu but not on 32-bit 
hppa2.0w-hp-hpux11.11.
So, it might be ELF specific.

On the linux target, r257884 was okay and r257960 bad. Last target 
change in February was r257672.

[Bug fortran/84848] [8 Regression] FAIL: gfortran.dg/coarray/event_3.f08 -fcoarray=single -O2 -latomic execution test

2018-03-13 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84848

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2018-03-13
 Ever confirmed|0   |1

--- Comment #1 from Dominique d'Humieres  ---
WORKSFORME on x86_64-apple-darwin17. A target issue?

[Bug fortran/84848] [8 Regression] FAIL: gfortran.dg/coarray/event_3.f08 -fcoarray=single -O2 -latomic execution test

2018-03-13 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84848

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |8.0