Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gcc_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gcc_check--master-arm |
success
|
Test passed
|
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 |
success
|
Test passed
|
Commit Message
Hi all,
Attached patch adds a test for zero that is needed for write_boz to work
correctly. Almost obvious.
Regression tested on x86_64.
Ok for trunk?
Jerry
Author: Jerry DeLisle <jvdelisle@gcc.gnu.org>
Date: Mon Dec 2 19:45:26 2024 -0800
Fortran: Fix B64.0 formatted write output.
PR fortran/117820
libgfortran/ChangeLog:
* io/write.c (write_b): Add test for zero needed by write_boz.
gcc/testsuite/ChangeLog:
* gfortran.dg/pr117820.f90: New test.
Comments
Hi Jerry,
That's fine for trunk and, after a decent interval, I would suggest that
you backport to 14-branch.
Please add the name of the contributor to the testcase unless you have been
asked not to.
Thanks
Paul
On Tue, 3 Dec 2024 at 04:13, Jerry D <jvdelisle2@gmail.com> wrote:
> Hi all,
>
> Attached patch adds a test for zero that is needed for write_boz to work
> correctly. Almost obvious.
>
> Regression tested on x86_64.
>
> Ok for trunk?
>
> Jerry
>
> Author: Jerry DeLisle <jvdelisle@gcc.gnu.org>
> Date: Mon Dec 2 19:45:26 2024 -0800
>
> Fortran: Fix B64.0 formatted write output.
>
> PR fortran/117820
>
> libgfortran/ChangeLog:
>
> * io/write.c (write_b): Add test for zero needed by write_boz.
>
> gcc/testsuite/ChangeLog:
>
> * gfortran.dg/pr117820.f90: New test.
>
>
Hi Jerry,
regarding the testcase, these variants are both standard-conforming and
silent under -pedantic:
x = ibset (0_8, 63)
x = ibset (0_8, bit_size(x)-1)
No trickery needed.
Cheers,
Harald
Am 03.12.24 um 05:13 schrieb Jerry D:
> Hi all,
>
> Attached patch adds a test for zero that is needed for write_boz to work
> correctly. Almost obvious.
>
> Regression tested on x86_64.
>
> Ok for trunk?
>
> Jerry
>
> Author: Jerry DeLisle <jvdelisle@gcc.gnu.org>
> Date: Mon Dec 2 19:45:26 2024 -0800
>
> Fortran: Fix B64.0 formatted write output.
>
> PR fortran/117820
>
> libgfortran/ChangeLog:
>
> * io/write.c (write_b): Add test for zero needed by write_boz.
>
> gcc/testsuite/ChangeLog:
>
> * gfortran.dg/pr117820.f90: New test.
>
new file mode 100644
@@ -0,0 +1,12 @@
+! { dg-do run }
+! { dg-options "-std=gnu" }
+! see pr117820, -std=gnu for this test needed to avoid a warning with -pedantic
+! on line 9 below.
+program test
+ integer(8) :: x
+ character(80) :: output
+ output = "garbage"
+ x = -huge(x) - 1_8
+ write(output, '("<",B64.0,">")') x
+ if (output .ne. "<1000000000000000000000000000000000000000000000000000000000000000>") stop 1
+end program
@@ -1392,6 +1392,10 @@ write_b (st_parameter_dt *dtp, const fnode *f, const char *source, int len)
{
n = extract_uint (source, len);
p = btoa (n, itoa_buf, sizeof (itoa_buf));
+
+ /* Test for zero. Needed by write_boz. */
+ if (n != 0)
+ n = 1;
write_boz (dtp, f, p, n, len);
}
}