public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/60730] New: 'Round of a fixed point type incorrectly truncates its operand instead of rounding it
@ 2014-04-01 15:44 georggcc at googlemail dot com
  2014-04-01 15:46 ` [Bug ada/60730] " georggcc at googlemail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: georggcc at googlemail dot com @ 2014-04-01 15:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60730

            Bug ID: 60730
           Summary: 'Round of a fixed point type incorrectly truncates its
                    operand instead of rounding it
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: georggcc at googlemail dot com

Created attachment 32517
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32517&action=edit
full program text

The program below raises, but should not; LRM 3.5.10 says
that Centi'Round should round away from 0 in the case
presented here.

The program attached to this report tries to reflect the
discussion in comp.lang.ada that started on 22nd of Jan 2014,
"How to round to the nearest fixed-point value".
The effect seen has been classified as a compiler bug: the
program should run as is, with no output. Instead, it raises
Program_Error because the value of 0.999, supposedly
rounded to 3 digits in `Rounded`, is not 1.00, but 0.99. 

$ gnatmake -gnatv -gnatwa round_decimal
gcc -c -gnatv -gnatwa round_decimal.adb

GNAT 4.9.0 20140331 (experimental)
Copyright 1992-2014, Free Software Foundation, Inc.

Compiling: round_decimal.adb (source file time stamp: 2014-04-01 15:39:04)
 38 lines: No errors
gnatbind -x round_decimal.ali
gnatlink round_decimal.ali

$ ./round_decimal 

raised PROGRAM_ERROR : round_decimal.adb:35 explicit raise


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

* [Bug ada/60730] 'Round of a fixed point type incorrectly truncates its operand instead of rounding it
  2014-04-01 15:44 [Bug ada/60730] New: 'Round of a fixed point type incorrectly truncates its operand instead of rounding it georggcc at googlemail dot com
@ 2014-04-01 15:46 ` georggcc at googlemail dot com
  2014-04-11 13:59 ` georggcc at googlemail dot com
  2014-04-11 16:41 ` gnugcc at marino dot st
  2 siblings, 0 replies; 4+ messages in thread
From: georggcc at googlemail dot com @ 2014-04-01 15:46 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60730

Georg <georggcc at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |georggcc at googlemail dot com

--- Comment #1 from Georg <georggcc at googlemail dot com> ---
Don't know if #41416 is related in any way, but the subject seems similar.


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

* [Bug ada/60730] 'Round of a fixed point type incorrectly truncates its operand instead of rounding it
  2014-04-01 15:44 [Bug ada/60730] New: 'Round of a fixed point type incorrectly truncates its operand instead of rounding it georggcc at googlemail dot com
  2014-04-01 15:46 ` [Bug ada/60730] " georggcc at googlemail dot com
@ 2014-04-11 13:59 ` georggcc at googlemail dot com
  2014-04-11 16:41 ` gnugcc at marino dot st
  2 siblings, 0 replies; 4+ messages in thread
From: georggcc at googlemail dot com @ 2014-04-11 13:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60730

--- Comment #3 from Georg <georggcc at googlemail dot com> ---
I have used the new simplified bug reporting form, hence no triple.

Several platforms are affected; the GCC 4.9 used with this report
was built on Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37
PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64.
See -v below.

According to the first public mention, these are also
affected (quoting the USENET message):
gnat 4.6.3 ("debian stable kfreebsd"), 
gnat-aux 4.7.3 ("from FreeBSD ports").

I also just checked the gcc build for dotnet-GNAT
(GNAT GPL (20130314)), same result.

$ gcc -v
COLLECT_GCC=/Volumes/Macintosh HD/Users/bauhaus/4.9/bin/gcc
COLLECT_LTO_WRAPPER=/Volumes/Macintosh\
HD/Users/bauhaus/4.9/bin/../libexec/gcc/x86_64-apple-darwin13.1.0/4.9.0/lto-wrapper
Target: x86_64-apple-darwin13.1.0
Configured with: /Macintosh_HD/Users/bauhaus/src/GCC-trunk/configure
--prefix=/Macintosh_HD/Users/bauhaus/4.9 --disable-nls
--enable-languages=c,ada,c++ CC=gcc
Thread model: posix
gcc version 4.9.0 20140331 (experimental) (GCC)


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

* [Bug ada/60730] 'Round of a fixed point type incorrectly truncates its operand instead of rounding it
  2014-04-01 15:44 [Bug ada/60730] New: 'Round of a fixed point type incorrectly truncates its operand instead of rounding it georggcc at googlemail dot com
  2014-04-01 15:46 ` [Bug ada/60730] " georggcc at googlemail dot com
  2014-04-11 13:59 ` georggcc at googlemail dot com
@ 2014-04-11 16:41 ` gnugcc at marino dot st
  2 siblings, 0 replies; 4+ messages in thread
From: gnugcc at marino dot st @ 2014-04-11 16:41 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60730

--- Comment #4 from John Marino <gnugcc at marino dot st> ---
FreeBSD GNAT 4.9.0 is the same 4.7.3 (allegedly broken):

FreeBSD draco.synsport.com 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Thu
Jan 16 22:34:59 UTC 2014     root@snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC
 amd64

> root@draco:/home/marino/test/rounding # /usr/local/gcc-aux/bin/ada --version
ada (GCC) 4.9.0 20140406 (prerelease) -=> GNAT AUX [FreeBSD64]
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


> root@draco:/home/marino/test/rounding # ./round_decimal

raised PROGRAM_ERROR : round_decimal.adb:34 explicit raise


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

end of thread, other threads:[~2014-04-11 16:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-01 15:44 [Bug ada/60730] New: 'Round of a fixed point type incorrectly truncates its operand instead of rounding it georggcc at googlemail dot com
2014-04-01 15:46 ` [Bug ada/60730] " georggcc at googlemail dot com
2014-04-11 13:59 ` georggcc at googlemail dot com
2014-04-11 16:41 ` gnugcc at marino dot st

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).