public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/67531] New: FAIL: gfortran.dg/ieee/large_2.f90   -O0  execution test
@ 2015-09-09 22:09 pthaugen at gcc dot gnu.org
  2015-09-10 21:31 ` [Bug fortran/67531] " pthaugen at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: pthaugen at gcc dot gnu.org @ 2015-09-09 22:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67531
           Summary: FAIL: gfortran.dg/ieee/large_2.f90   -O0  execution
                    test
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pthaugen at gcc dot gnu.org
                CC: fxcoudert at gcc dot gnu.org
  Target Milestone: ---
            Target: powerpc*-*-*

Testcase has been failing since added to the testsuite.

pthaugen@genoa:~$
/home/gccbuild/build/nightly/build-gcc-trunk/gcc/testsuite/gfortran1/../../gfortran
-B/home/gccbuild/build/nightly/build-gcc-trunk/gcc/testsuite/gfortran1/../../
-B/home/gccbuild/build/nightly/build-gcc-trunk/powerpc64le-unknown-linux-gnu/./libgfortran/
/home/gccbuild/gcc_trunk_anonsvn/gcc/gcc/testsuite/gfortran.dg/ieee/large_2.f90
-fno-diagnostics-show-caret -fdiagnostics-color=never -O0 -pedantic-errors
-fintrinsic-modules-path
/home/gccbuild/build/nightly/build-gcc-trunk/powerpc64le-unknown-linux-gnu/./libgfortran/
-fno-unsafe-math-optimizations -frounding-math -fsignaling-nans
-B/home/gccbuild/build/nightly/build-gcc-trunk/powerpc64le-unknown-linux-gnu/./libgfortran/.libs
-L/home/gccbuild/build/nightly/build-gcc-trunk/powerpc64le-unknown-linux-gnu/./libgfortran/.libs
-L/home/gccbuild/build/nightly/build-gcc-trunk/powerpc64le-unknown-linux-gnu/./libgfortran/.libs
-L/home/gccbuild/build/nightly/build-gcc-trunk/powerpc64le-unknown-linux-gnu/./libatomic/.libs
-lm -o ./large_2.exe -g

pthaugen@genoa:~$ ./large_2.exe
  0.333333333333333333333333333333329225       
0.333333333333333333333333333333329225      

Program aborted. Backtrace:
Aborted (core dumped)

pthaugen@genoa:~$ gdb large_2.exe
...
(gdb) run
Starting program: /home/pthaugen/large_2.exe 
  0.333333333333333333333333333333329225       
0.333333333333333333333333333333329225      

Program aborted. Backtrace:

Program received signal SIGABRT, Aborted.
0x00003fffb7ba0a88 in __GI_raise (sig=<optimized out>) at
../nptl/sysdeps/unix/sysv/linux/raise.c:56
56      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00003fffb7ba0a88 in __GI_raise (sig=<optimized out>) at
../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00003fffb7ba686c in __GI_abort () at abort.c:89
#2  0x00003fffb7e7b160 in _gfortrani_sys_abort ()
    at /home/gccbuild/gcc_trunk_anonsvn/gcc/libgfortran/runtime/error.c:182
#3  0x00003fffb7f5c778 in _gfortran_abort ()
    at /home/gccbuild/gcc_trunk_anonsvn/gcc/libgfortran/intrinsics/abort.c:33
#4  0x00000000100018d4 in check_equal1
(x=0.33333333333333333333333333333332922, 
    y=0.33333333333333333333333333333332922)
    at
/home/gccbuild/gcc_trunk_anonsvn/gcc/gcc/testsuite/gfortran.dg/ieee/large_2.f90:117
#5  0x0000000010001010 in MAIN__ ()
    at
/home/gccbuild/gcc_trunk_anonsvn/gcc/gcc/testsuite/gfortran.dg/ieee/large_2.f90:44


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

* [Bug fortran/67531] FAIL: gfortran.dg/ieee/large_2.f90   -O0  execution test
  2015-09-09 22:09 [Bug fortran/67531] New: FAIL: gfortran.dg/ieee/large_2.f90 -O0 execution test pthaugen at gcc dot gnu.org
@ 2015-09-10 21:31 ` pthaugen at gcc dot gnu.org
  2015-09-10 21:45 ` fxcoudert at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pthaugen at gcc dot gnu.org @ 2015-09-10 21:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Pat Haugen <pthaugen at gcc dot gnu.org> ---
(In reply to Francois-Xavier Coudert from comment #1)
> Thanks for the report. So apparently, on powerpc64le-unknown-linux-gnu, long
> double division of 1.0L by 3.0L with rounding mode set to "down" is
> incorrect.
> 
> Can you compile and run the following C test case?
> 
> $ cat z.c 
> #include <fenv.h>
> #include <stdio.h>
> 
> int main (void)
> {
>   long double x1, x2, x;
> 
>   fesetround (FE_UPWARD);
>   x1 = 1;
>   x = 3;
>   x1 = x1 / x;
> 
>   fesetround (FE_DOWNWARD);
>   x2 = 1;
>   x = 3;
>   x2 = x2 / x;
> 
>   printf ("%.40Lg\n", x1);
>   printf ("%.40Lg\n", x2);
> }
> $ gcc z.c -lm && ./a.out 
> 0.3333333333333333333423683514373792036167
> 0.3333333333333333333152632971252415927665
> 
> 
> Above is the result on x86_64-linux, so the outcome shouldn't be identical,
> but the two numbers output should not be equal.

pthaugen@genoa:~$ ~/install/gcc/trunk/bin/gcc z.c -lm && ./a.out
0.3333333333333333333333333333333353876586
0.3333333333333333333333333333333292246827


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

* [Bug fortran/67531] FAIL: gfortran.dg/ieee/large_2.f90   -O0  execution test
  2015-09-09 22:09 [Bug fortran/67531] New: FAIL: gfortran.dg/ieee/large_2.f90 -O0 execution test pthaugen at gcc dot gnu.org
  2015-09-10 21:31 ` [Bug fortran/67531] " pthaugen at gcc dot gnu.org
@ 2015-09-10 21:45 ` fxcoudert at gcc dot gnu.org
  2015-09-10 22:00 ` schwab@linux-m68k.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2015-09-10 21:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
(In reply to Pat Haugen from comment #2)
> pthaugen@genoa:~$ ~/install/gcc/trunk/bin/gcc z.c -lm && ./a.out
> 0.3333333333333333333333333333333353876586
> 0.3333333333333333333333333333333292246827

How about with this? I'm trying to come as close as possible to the exact
sequence of fe.etround() calls as the Fortran front-end and runtime library
would end up performing…


#include <fenv.h>
#include <stdio.h>

int main (void)
{
  int r;
  long double x1, x2, x;

  x1 = 1;
  x = 3;
  r = fegetround ();
  fesetround (FE_UPWARD);
  x1 = x1 / x;
  fesetround (r);

  x2 = 1;
  x = 3;
  r = fegetround ();
  fesetround (FE_DOWNWARD);
  x2 = x2 / x;
  fesetround (r);

  printf ("%.40Lg\n", x1);
  printf ("%.40Lg\n", x2);
}
>From gcc-bugs-return-496923-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Sep 10 21:52:57 2015
Return-Path: <gcc-bugs-return-496923-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 70526 invoked by alias); 10 Sep 2015 21:52:57 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 70460 invoked by uid 48); 10 Sep 2015 21:52:54 -0000
From: "pangbw at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/59124] [4.9/5/6 Regression] Wrong warnings "array subscript is above array bounds"
Date: Thu, 10 Sep 2015 21:52:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 4.8.3
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: normal
X-Bugzilla-Who: pangbw at gmail dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.4
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59124-4-jJrtz7gH2X@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59124-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59124-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-09/txt/msg00901.txt.bz2
Content-length: 1339

https://gcc.gnu.org/bugzilla/show_bug.cgi?idY124

--- Comment #19 from baoshan <pangbw at gmail dot com> ---
I did a little investigation to the code:

The warning occurs because tree_int_cst_lt (up_bound, up_sub) is true here:
  else if (TREE_CODE (up_sub) == INTEGER_CST
           && (ignore_off_by_one
               ? (tree_int_cst_lt (up_bound, up_sub)
                  && !tree_int_cst_equal (up_bound_p1, up_sub))
               : (tree_int_cst_lt (up_bound, up_sub)
                  || tree_int_cst_equal (up_bound_p1, up_sub))))
    {
      if (dump_file && (dump_flags & TDF_DETAILS))
        {
          fprintf (dump_file, "Array bound warning for ");
          dump_generic_expr (MSG_NOTE, TDF_SLIM, ref);
          fprintf (dump_file, "\n");
        }
      warning_at (location, OPT_Warray_bounds,
=>                "array subscript is above array bounds");
      TREE_NO_WARNING (ref) = 1;
    }

I dumped the tree up_bound and up_sub:
(gdb) p debug_tree(up_bound)
 <integer_cst 0x7ffff6acd3a8 type <integer_type 0x7ffff6c3d0a8 sizetype>
constant 5>
 p debug_tree(up_sub)
 <integer_cst 0x7ffff6ae92d0 type <integer_type 0x7ffff6c3d738 unsigned int>
constant 4294967291>

We can see the value of up_sub is represented as unsigned int value 4294967291
which is really weird to me, it suppose to be a int value -5 here.


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

* [Bug fortran/67531] FAIL: gfortran.dg/ieee/large_2.f90   -O0  execution test
  2015-09-09 22:09 [Bug fortran/67531] New: FAIL: gfortran.dg/ieee/large_2.f90 -O0 execution test pthaugen at gcc dot gnu.org
  2015-09-10 21:31 ` [Bug fortran/67531] " pthaugen at gcc dot gnu.org
  2015-09-10 21:45 ` fxcoudert at gcc dot gnu.org
@ 2015-09-10 22:00 ` schwab@linux-m68k.org
  2015-09-11 13:50 ` [Bug fortran/67531] No IEEE rounding support for powerpc long double type pthaugen at gcc dot gnu.org
  2021-05-04 12:31 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: schwab@linux-m68k.org @ 2015-09-10 22:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andreas Schwab <schwab@linux-m68k.org> ---
IBM long double does not support non-default rounding.


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

* [Bug fortran/67531] No IEEE rounding support for powerpc long double type
  2015-09-09 22:09 [Bug fortran/67531] New: FAIL: gfortran.dg/ieee/large_2.f90 -O0 execution test pthaugen at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-09-10 22:00 ` schwab@linux-m68k.org
@ 2015-09-11 13:50 ` pthaugen at gcc dot gnu.org
  2021-05-04 12:31 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pthaugen at gcc dot gnu.org @ 2015-09-11 13:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Pat Haugen <pthaugen at gcc dot gnu.org> ---
(In reply to Francois-Xavier Coudert from comment #3)
> How about with this? I'm trying to come as close as possible to the exact
> sequence of fe.etround() calls as the Fortran front-end and runtime library
> would end up performing…
> 
> 
> #include <fenv.h>
> #include <stdio.h>
> 
> int main (void)
> {
>   int r;
>   long double x1, x2, x;
> 
>   x1 = 1;
>   x = 3;
>   r = fegetround ();
>   fesetround (FE_UPWARD);
>   x1 = x1 / x;
>   fesetround (r);
> 
>   x2 = 1;
>   x = 3;
>   r = fegetround ();
>   fesetround (FE_DOWNWARD);
>   x2 = x2 / x;
>   fesetround (r);
> 
>   printf ("%.40Lg\n", x1);
>   printf ("%.40Lg\n", x2);
> }

pthaugen@genoa:~$ ~/install/gcc/trunk/bin/gcc junk.c -lm && ./a.out
0.3333333333333333333333333333333353876586
0.3333333333333333333333333333333292246828
>From gcc-bugs-return-496981-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Sep 11 13:51:00 2015
Return-Path: <gcc-bugs-return-496981-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 10448 invoked by alias); 11 Sep 2015 13:51:00 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 10181 invoked by uid 48); 11 Sep 2015 13:50:57 -0000
From: "olegendo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/59478] Optimize variable access via byte copy
Date: Fri, 11 Sep 2015 13:51:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: olegendo at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59478-4-hlpQWivXDr@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59478-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59478-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-09/txt/msg00959.txt.bz2
Content-length: 1053

https://gcc.gnu.org/bugzilla/show_bug.cgi?idY478

--- Comment #1 from Oleg Endo <olegendo at gcc dot gnu.org> ---
(In reply to Oleg Endo from comment #0)
> This happens at least on SH with trunk rev 205905 (4.9).
> I'm not sure whether these are target specific or not.
>
> Accessing float values as integers can be done in various ways.  One way is
> to do a byte copy...
>
> int float_as_int (float val)
> {
>   char valbytes[sizeof (float)];
>   __builtin_memcpy (valbytes, &val, sizeof (float));
>
>   int result;
>   __builtin_memcpy (&result, valbytes, sizeof (float));
>
>   return result;
> }
>
> The above compiled with -m4-single -ml -O2 results in:
>
>         add     #-8,r15
>         fmov.s  fr5,@r15
>         mov.l   @r15,r0
>         rts
>         add     #8,r15
>
> which is not so bad actually, but could be done better by utilizing the fpul
> register, as it is done when using the union approach:

This case got better.  It now produces the expected sequence:

        flds    fr5,fpul
        rts
        sts     fpul,r0


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

* [Bug fortran/67531] No IEEE rounding support for powerpc long double type
  2015-09-09 22:09 [Bug fortran/67531] New: FAIL: gfortran.dg/ieee/large_2.f90 -O0 execution test pthaugen at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2015-09-11 13:50 ` [Bug fortran/67531] No IEEE rounding support for powerpc long double type pthaugen at gcc dot gnu.org
@ 2021-05-04 12:31 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-04 12:31 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

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

end of thread, other threads:[~2021-05-04 12:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-09 22:09 [Bug fortran/67531] New: FAIL: gfortran.dg/ieee/large_2.f90 -O0 execution test pthaugen at gcc dot gnu.org
2015-09-10 21:31 ` [Bug fortran/67531] " pthaugen at gcc dot gnu.org
2015-09-10 21:45 ` fxcoudert at gcc dot gnu.org
2015-09-10 22:00 ` schwab@linux-m68k.org
2015-09-11 13:50 ` [Bug fortran/67531] No IEEE rounding support for powerpc long double type pthaugen at gcc dot gnu.org
2021-05-04 12:31 ` rguenth at gcc dot gnu.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).