[Bug libfortran/79540] [7/8/9 Regression] FAIL: gfortran.dg/fmt_fw_d.f90 -O0 execution test

2019-03-25 Thread danglin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79540

--- Comment #24 from John David Anglin  ---
Author: danglin
Date: Mon Mar 25 11:48:36 2019
New Revision: 269911

URL: https://gcc.gnu.org/viewcvs?rev=269911&root=gcc&view=rev
Log:
PR libgfortran/79540
* io/write_float.def (build_float_string): Don't copy digits when
ndigits is negative.


Modified:
trunk/libgfortran/ChangeLog
trunk/libgfortran/io/write_float.def

[Bug libfortran/79540] [7/8/9 Regression] FAIL: gfortran.dg/fmt_fw_d.f90 -O0 execution test

2019-03-23 Thread jvdelisle at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79540

--- Comment #23 from Jerry DeLisle  ---
(In reply to John David Anglin from comment #22)
> Created attachment 46014 [details]
> Patch
> 
> Previous patch broke gfortran.dg/fmt_g0_6.f08 on hppa64-hp-hpux11.11.  It
> seems we need to handle the case where ndigits is zero.

I regression tested this on x86_64 and all is well. Patch is approved to commit
if fixes on hppa64.

Thanks for effort!

[Bug libfortran/79540] [7/8/9 Regression] FAIL: gfortran.dg/fmt_fw_d.f90 -O0 execution test

2019-03-23 Thread danglin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79540

John David Anglin  changed:

   What|Removed |Added

  Attachment #45989|0   |1
is obsolete||

--- Comment #22 from John David Anglin  ---
Created attachment 46014
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46014&action=edit
Patch

Previous patch broke gfortran.dg/fmt_g0_6.f08 on hppa64-hp-hpux11.11.  It
seems we need to handle the case where ndigits is zero.

[Bug libfortran/79540] [7/8/9 Regression] FAIL: gfortran.dg/fmt_fw_d.f90 -O0 execution test

2019-03-18 Thread dave.anglin at bell dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79540

--- Comment #21 from dave.anglin at bell dot net ---
On 2019-03-18 2:15 p.m., dominiq at lps dot ens.fr wrote:
> Are you planning to submit the patch to the mail lists?
While it seems to work, it is clear the author of this code thought ndigits was
positive.
So, something else might be wrong.

[Bug libfortran/79540] [7/8/9 Regression] FAIL: gfortran.dg/fmt_fw_d.f90 -O0 execution test

2019-03-18 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79540

--- Comment #20 from Dominique d'Humieres  ---
> Created attachment 45989 [details]
> Patch
>
> This fixes the stack overflow in memcpy.

Are you planning to submit the patch to the mail lists?

[Bug libfortran/79540] [7/8/9 Regression] FAIL: gfortran.dg/fmt_fw_d.f90 -O0 execution test

2019-03-18 Thread danglin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79540

--- Comment #19 from John David Anglin  ---
The patch also fixes test failure on hppa2.0w-hp-hpux11.11.

[Bug libfortran/79540] [7/8/9 Regression] FAIL: gfortran.dg/fmt_fw_d.f90 -O0 execution test

2019-03-18 Thread danglin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79540

--- Comment #18 from John David Anglin  ---
Created attachment 45989
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45989&action=edit
Patch

This fixes the stack overflow in memcpy.

[Bug libfortran/79540] [7/8/9 Regression] FAIL: gfortran.dg/fmt_fw_d.f90 -O0 execution test

2019-03-18 Thread danglin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79540

--- Comment #17 from John David Anglin  ---
   0x7adcb864 :cmpclr,> r21,r3,r0
   0x7adcb868 :copy r21,r3
   0x7adcb86c :stw r20,-8c(sp)
   0x7adcb870 :stw r21,-90(sp)
   0x7adcb874 :copy r19,r4
   0x7adcb878 :copy r5,r25
   0x7adcb87c :b,l 0x7adab298 ,rp
   0x7adcb880 :copy r3,r24
=> 0x7adcb884 :add,l r6,r3,ret0

(gdb) p/x $r21
$12 = 0x1
(gdb) p nafter
$13 = 1
(gdb) p ndigits
No symbol "ndigits" in current context.
(gdb) p/x $r3
$14 = 0xfffd

The cmpclr does a signed compare between $r21 and $r3.  The following
instruction is nullified because $r21 > $r3.  Presumably, $r3 is supposed to
contain ndigits.

  /* Set digits after the decimal point, padding with zeros.  */
  if (nafter > 0)
{
  if (nafter > ndigits)
i = ndigits;
  else
i = nafter;

  memcpy (put, digits, i);
  while (i < nafter)
put[i++] = '0';

  digits += i;
  ndigits -= i;
  put += nafter;
}

[Bug libfortran/79540] [7/8/9 Regression] FAIL: gfortran.dg/fmt_fw_d.f90 -O0 execution test

2019-03-18 Thread danglin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79540

--- Comment #16 from John David Anglin  ---
print '(f2.1)',100.00
end

Here is backtrace info:

Breakpoint 2, 0x7afce720 in memcpy () from /usr/lib/libc.2
(gdb) p/x $r26
$6 = 0x7eff0c1d
(gdb) p/x $r25
$8 = 0x7eff0d9a
(gdb) p/x $r24
$5 = 0xfffd

$r24 contains number of bytes to copy.

(gdb) bt
Python Exception  Failed to load
/home/gnu/lib/python2.7/lib-dynload/itertools.sl:
#0  0x7afce720 in memcpy () from /usr/lib/libc.2
#1  0x7adcb884 in build_float_string (dtp=0x7eff0658, f=0x0,
buffer=0x7eff0d98 '+100.\000', size=1, nprinted=0, precision=1,
sign_bit=0, zero_flag=0, npad=0,
result=0x7eff0c18 '.\377\006\364\000', len=0x7eff0f18)
at ../../../gcc/libgfortran/io/write_float.def:630
#2  0x7adcc00c in get_float_string (dtp=0xfffd, f=0x7eff0658,
source=0xfffd ,
kind=2130644378, comp_d=0, buffer=0x7eff0d98 '+100.\000', precision=1,
size=6, result=0x7eff0c18 '.\377\006\364\000', res_len=0x7eff0f18)
at ../../../gcc/libgfortran/io/write_float.def:1065
#3  0x7adcd4dc in write_float_0 (dtp=0xfffd, f=0x7eff0c1d,
source=0x7eff0c1c '.\377\006\364\000', kind=2130644378)
at ../../../gcc/libgfortran/io/write.c:1584
#4  0x7adc1420 in formatted_transfer_scalar_write (dtp=0xfffd,
type=2130643997, p=0x7eff0658, kind=28, size=4)
at ../../../gcc/libgfortran/io/transfer.c:2097
#5  0x7adc1984 in formatted_transfer (dtp=0x7eff0658, type=BT_UNKNOWN,
p=0xfffd, kind=2130643996, size=4, nelems=1)
at ../../../gcc/libgfortran/io/transfer.c:2335
#6  0x7adbd0a4 in wrap_scalar_transfer.constprop.0 (dtp=0x7eff0c1d,
type=2130644378, p=0xfffd, kind=1074790400, size=4)
at ../../../gcc/libgfortran/io/transfer.c:2369
#7  0x7adbd6c8 in *_gfortran_transfer_real (dtp=0xfffd, p=0x7eff0c1d,
kind=2130644378) at ../../../gcc/libgfortran/io/transfer.c:2396
#8  0x7adbd728 in *_gfortran_transfer_real_write (dtp=0x7eff0c1d,
p=0x7eff0d9a, kind=-3) at ../../../gcc/libgfortran/io/transfer.c:2402

write_float.def may be miscompiled.

[Bug libfortran/79540] [7/8/9 Regression] FAIL: gfortran.dg/fmt_fw_d.f90 -O0 execution test

2019-03-08 Thread danglin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79540

John David Anglin  changed:

   What|Removed |Added

 Status|WAITING |NEW
   Last reconfirmed|2017-02-16 00:00:00 |2019-3-8

[Bug libfortran/79540] [7/8/9 Regression] FAIL: gfortran.dg/fmt_fw_d.f90 -O0 execution test

2019-01-27 Thread danglin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79540

--- Comment #15 from John David Anglin  ---
print '(f2.1)',100.00
end

causes a stack overflow in memcpy:

(gdb) bt
Python Exception  Failed to load
/home/gnu/lib/python2.7/lib-dynload/itertools.sl:
#0  0xc01cf85c in memcpy () from /usr/lib/libc.2
#1  0xc1c0545c in ?? () from /home/gnu/gcc/gcc-7/lib/libgfortran.sl.4
#2  0x in ?? () from /usr/lib/libc.2

We seem to have a huge size argument (0xfffd).

Breakpoint 2, 0x7afce720 in memcpy () from /usr/lib/libc.2
(gdb) p/x $r26
$4 = 0x7eff0cfd
(gdb) p/x $r25
$5 = 0x7eff0e7a
(gdb) p/x $r24
$6 = 0xfffd
(gdb) bt
Python Exception  Failed to load
/home/gnu/lib/python2.7/lib-dynload/itertools.sl:
#0  0x7afce720 in memcpy () from /usr/lib/libc.2
#1  0x7ade245c in ?? () from /home/gnu/gcc/gcc-7/lib/libgfortran.sl.4
#2  0x7ade2f14 in ?? () from /home/gnu/gcc/gcc-7/lib/libgfortran.sl.4
#3  0x7ade42c4 in ?? () from /home/gnu/gcc/gcc-7/lib/libgfortran.sl.4
#4  0x7add8444 in ?? () from /home/gnu/gcc/gcc-7/lib/libgfortran.sl.4
#5  0x7add8af4 in ?? () from /home/gnu/gcc/gcc-7/lib/libgfortran.sl.4
#6  0x7add4adc in ?? () from /home/gnu/gcc/gcc-7/lib/libgfortran.sl.4
#7  0x7add4b38 in ?? () from /home/gnu/gcc/gcc-7/lib/libgfortran.sl.4

[Bug libfortran/79540] [7/8/9 Regression] FAIL: gfortran.dg/fmt_fw_d.f90 -O0 execution test

2019-01-27 Thread dave.anglin at bell dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79540

--- Comment #14 from dave.anglin at bell dot net ---
On 2019-01-26 7:25 a.m., dominiq at lps dot ens.fr wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79540
>
> --- Comment #13 from Dominique d'Humieres  ---
>> print '(f1.0)',100.00  ! => len=1 *: no digits
>> print '(f2.0)',100.00  ! => len=0 : no digits
>> print '(f3.0)',100.00  ! => len=0 : no digits
>> print '(f1.1)',100.00  ! => len=1 *: no digits
>> print '(f3.1)',100.00  ! => len=0 : no digits
> On darwin I get
>
>  print '(f1.0)',100.00  ! => len=1 *: no digits
>  print '(f2.0)',100.00  ! => len=2 **: no digits
>  print '(f3.0)',100.00  ! => len=3 ***: no digits
>  print '(f1.1)',100.00  ! => len=1 *: no digits
>  print '(f2.1)',100.00  ! => len=2 **: no digits
>  print '(f3.1)',100.00  ! => len=3 ***: no digits
>
> What is the output of
>
> print '(f3.1)',100.00
> end
>
> ? If it not '***', it looks like a bug in your libraries?
>
It's '***'.

[Bug libfortran/79540] [7/8/9 Regression] FAIL: gfortran.dg/fmt_fw_d.f90 -O0 execution test

2019-01-26 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79540

--- Comment #13 from Dominique d'Humieres  ---
> print '(f1.0)',100.00  ! => len=1 *: no digits
> print '(f2.0)',100.00  ! => len=0 : no digits
> print '(f3.0)',100.00  ! => len=0 : no digits
> print '(f1.1)',100.00  ! => len=1 *: no digits
> print '(f3.1)',100.00  ! => len=0 : no digits

On darwin I get

 print '(f1.0)',100.00  ! => len=1 *: no digits
 print '(f2.0)',100.00  ! => len=2 **: no digits
 print '(f3.0)',100.00  ! => len=3 ***: no digits
 print '(f1.1)',100.00  ! => len=1 *: no digits
 print '(f2.1)',100.00  ! => len=2 **: no digits
 print '(f3.1)',100.00  ! => len=3 ***: no digits

What is the output of

print '(f3.1)',100.00
end

? If it not '***', it looks like a bug in your libraries?

[Bug libfortran/79540] [7/8/9 Regression] FAIL: gfortran.dg/fmt_fw_d.f90 -O0 execution test

2018-12-06 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79540

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|7.4 |7.5