public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/48720] New: quad precision literals do not work
@ 2011-04-21 22:31 sliwa at blue dot cft.edu.pl
  2011-04-21 22:33 ` [Bug fortran/48720] " sliwa at blue dot cft.edu.pl
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: sliwa at blue dot cft.edu.pl @ 2011-04-21 22:31 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: quad precision literals do not work
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: sliwa@blue.cft.edu.pl


real*16 x
  x = 1.1q0
  write(*,*) x
  end

prints

   1.1000000238418579101562500000000000      

I am not quite sure, but shouldn't this be a quad precision literal?


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

* [Bug fortran/48720] quad precision literals do not work
  2011-04-21 22:31 [Bug fortran/48720] New: quad precision literals do not work sliwa at blue dot cft.edu.pl
@ 2011-04-21 22:33 ` sliwa at blue dot cft.edu.pl
  2011-04-22  2:22 ` jvdelisle at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: sliwa at blue dot cft.edu.pl @ 2011-04-21 22:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Cezary Sliwa <sliwa at blue dot cft.edu.pl> 2011-04-21 22:33:36 UTC ---
Sorry, I almost forgot:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/gcc/4.6.0/libexec/gcc/x86_64-redhat-linux/4.6.0/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../gcc-4.6.0/configure --prefix=/opt/gcc/4.6.0 --enable-shared
--enable-threads=posix --enable-checking=release --with-system-zlib
--enable-__cxa_atexit --disable-libunwind-exceptions
--enable-languages=c,c++,fortran --with-cpu=generic --build=x86_64-redhat-linux
--enable-bootstrap
Thread model: posix
gcc version 4.6.0 (GCC) 

$ uname -a
Linux sl2klast.ifpan.edu.pl 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:52:25 EST
2011 x86_64 x86_64 x86_64 GNU/Linux

(CentOS 5.5 x86_64)


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

* [Bug fortran/48720] quad precision literals do not work
  2011-04-21 22:31 [Bug fortran/48720] New: quad precision literals do not work sliwa at blue dot cft.edu.pl
  2011-04-21 22:33 ` [Bug fortran/48720] " sliwa at blue dot cft.edu.pl
@ 2011-04-22  2:22 ` jvdelisle at gcc dot gnu.org
  2011-04-22  4:08 ` kargl at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2011-04-22  2:22 UTC (permalink / raw)
  To: gcc-bugs

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

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jvdelisle at gcc dot
                   |                            |gnu.org

--- Comment #2 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-04-22 02:21:43 UTC ---
Try this:

real(16) ::  x
x = 1.1q0_16
write(*,*) x
end

I think we are not handling the 'q' as any more than an exponent marker. 'e'
works just as well.

I would suggest updating your syntax a bit to something like this:

integer, parameter :: wp = 16
real(wp) :: x
x = 1.1e0_wp ! or just x = 1.1_wp
write(*,*) x
end

Of course I am getting a little off topic. I don't think 'q' is standard
conforming. (maybe I am wrong)


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

* [Bug fortran/48720] quad precision literals do not work
  2011-04-21 22:31 [Bug fortran/48720] New: quad precision literals do not work sliwa at blue dot cft.edu.pl
  2011-04-21 22:33 ` [Bug fortran/48720] " sliwa at blue dot cft.edu.pl
  2011-04-22  2:22 ` jvdelisle at gcc dot gnu.org
@ 2011-04-22  4:08 ` kargl at gcc dot gnu.org
  2011-04-22 12:47 ` jvdelisle at frontier dot com
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: kargl at gcc dot gnu.org @ 2011-04-22  4:08 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #3 from kargl at gcc dot gnu.org 2011-04-22 04:07:23 UTC ---
(In reply to comment #2)
> Try this:
> 
> real(16) ::  x
> x = 1.1q0_16
> write(*,*) x
> end
> 
> I think we are not handling the 'q' as any more than an exponent marker. 'e'
> works just as well.

Oh my, is gfortran accepting 1.1q0.  Let's stop that 
right now!  Use 1.1e0_16.


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

* [Bug fortran/48720] quad precision literals do not work
  2011-04-21 22:31 [Bug fortran/48720] New: quad precision literals do not work sliwa at blue dot cft.edu.pl
                   ` (2 preceding siblings ...)
  2011-04-22  4:08 ` kargl at gcc dot gnu.org
@ 2011-04-22 12:47 ` jvdelisle at frontier dot com
  2011-04-22 15:01 ` sgk at troutmask dot apl.washington.edu
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at frontier dot com @ 2011-04-22 12:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from jvdelisle at frontier dot com 2011-04-22 12:46:16 UTC ---
On 04/21/2011 09:08 PM, kargl at gcc dot gnu.org wrote:
--- snip ---
>>
>> I think we are not handling the 'q' as any more than an exponent marker. 'e'
>> works just as well.
>
> Oh my, is gfortran accepting 1.1q0.  Let's stop that
> right now!  Use 1.1e0_16.
>

Agree, and its in the front end somewhere.


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

* [Bug fortran/48720] quad precision literals do not work
  2011-04-21 22:31 [Bug fortran/48720] New: quad precision literals do not work sliwa at blue dot cft.edu.pl
                   ` (3 preceding siblings ...)
  2011-04-22 12:47 ` jvdelisle at frontier dot com
@ 2011-04-22 15:01 ` sgk at troutmask dot apl.washington.edu
  2011-04-22 15:16 ` sgk at troutmask dot apl.washington.edu
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2011-04-22 15:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Steve Kargl <sgk at troutmask dot apl.washington.edu> 2011-04-22 15:00:50 UTC ---
On Fri, Apr 22, 2011 at 12:47:03PM +0000, jvdelisle at frontier dot com wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48720
> 
> --- Comment #4 from jvdelisle at frontier dot com 2011-04-22 12:46:16 UTC ---
> On 04/21/2011 09:08 PM, kargl at gcc dot gnu.org wrote:
> --- snip ---
> >>
> >> I think we are not handling the 'q' as any more than an exponent marker. 'e'
> >> works just as well.
> >
> > Oh my, is gfortran accepting 1.1q0.  Let's stop that
> > right now!  Use 1.1e0_16.
> >
> 
> Agree, and its in the front end somewhere.
> 

It's match_real_constant in primary.c.

I suppose that question is do we want to disallow q.


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

* [Bug fortran/48720] quad precision literals do not work
  2011-04-21 22:31 [Bug fortran/48720] New: quad precision literals do not work sliwa at blue dot cft.edu.pl
                   ` (4 preceding siblings ...)
  2011-04-22 15:01 ` sgk at troutmask dot apl.washington.edu
@ 2011-04-22 15:16 ` sgk at troutmask dot apl.washington.edu
  2011-04-25 18:45 ` kargl at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2011-04-22 15:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Steve Kargl <sgk at troutmask dot apl.washington.edu> 2011-04-22 15:16:02 UTC ---
On Fri, Apr 22, 2011 at 08:00:33AM -0700, Steve Kargl wrote:
> On Fri, Apr 22, 2011 at 12:47:03PM +0000, jvdelisle at frontier dot com wrote:
> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48720
> > 
> > --- Comment #4 from jvdelisle at frontier dot com 2011-04-22 12:46:16 UTC ---
> > On 04/21/2011 09:08 PM, kargl at gcc dot gnu.org wrote:
> > --- snip ---
> > >>
> > >> I think we are not handling the 'q' as any more than an exponent marker. 'e'
> > >> works just as well.
> > >
> > > Oh my, is gfortran accepting 1.1q0.  Let's stop that
> > > right now!  Use 1.1e0_16.
> > >
> > 
> > Agree, and its in the front end somewhere.
> > 
> 
> It's match_real_constant in primary.c.
> 
> I suppose that question is do we want to disallow q.
> 

Reading the code suggests that there are other problems if we
continue to allow q.

program foo
   real(8) d
   real(16) q
   q = 1.q0_16
   d = 1.d0_8
   print *, d, q
end program foo


troutmask:sgk[203] gfc4x -o z ui.f90 
ui.f90:5.13:

   d = 1.d0_8
             1
Error: Real number at (1) has a 'd' exponent and an explicit kind

The above is required by the standard, so I think one should 
also mandate a similar error fro 1.q0_16.


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

* [Bug fortran/48720] quad precision literals do not work
  2011-04-21 22:31 [Bug fortran/48720] New: quad precision literals do not work sliwa at blue dot cft.edu.pl
                   ` (5 preceding siblings ...)
  2011-04-22 15:16 ` sgk at troutmask dot apl.washington.edu
@ 2011-04-25 18:45 ` kargl at gcc dot gnu.org
  2011-05-03  1:25 ` kargl at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: kargl at gcc dot gnu.org @ 2011-04-25 18:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from kargl at gcc dot gnu.org 2011-04-25 18:44:48 UTC ---
See

http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01986.html

for a patch.


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

* [Bug fortran/48720] quad precision literals do not work
  2011-04-21 22:31 [Bug fortran/48720] New: quad precision literals do not work sliwa at blue dot cft.edu.pl
                   ` (6 preceding siblings ...)
  2011-04-25 18:45 ` kargl at gcc dot gnu.org
@ 2011-05-03  1:25 ` kargl at gcc dot gnu.org
  2011-05-03  1:34 ` kargl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: kargl at gcc dot gnu.org @ 2011-05-03  1:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from kargl at gcc dot gnu.org 2011-05-03 01:23:49 UTC ---
Author: kargl
Date: Tue May  3 01:23:46 2011
New Revision: 173285

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173285
Log:
2011-05-02  Steven G. Kargl  <kargl@gcc.gnu.org>

    PR fortran/48720
    * gfortran.texi: Document the 'Q' exponent-letter extension.
    * invoke.texi: Document -Wreal-q-constant.
    * lang.opt: Add -Wreal-q-constant option.
    * gfortran.h: Add warn_real_q_constant to option struct.
    * primary.c (match_real_constant):  Use it.  Accept 'Q' as
    exponent-letter for REAL(16) real-literal-constant with a
    fallback to REAL(10) or error if REAL(10) is not available.
    * options.c (gfc_init_options, set_Wall) Set it.
    (gfc_handle_option): Handle new option.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/gfortran.texi
    trunk/gcc/fortran/invoke.texi
    trunk/gcc/fortran/lang.opt
    trunk/gcc/fortran/options.c
    trunk/gcc/fortran/primary.c


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

* [Bug fortran/48720] quad precision literals do not work
  2011-04-21 22:31 [Bug fortran/48720] New: quad precision literals do not work sliwa at blue dot cft.edu.pl
                   ` (7 preceding siblings ...)
  2011-05-03  1:25 ` kargl at gcc dot gnu.org
@ 2011-05-03  1:34 ` kargl at gcc dot gnu.org
  2011-05-04 19:20 ` kargl at gcc dot gnu.org
  2011-05-04 19:26 ` kargl at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: kargl at gcc dot gnu.org @ 2011-05-03  1:34 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011.05.03 01:33:20
     Ever Confirmed|0                           |1

--- Comment #9 from kargl at gcc dot gnu.org 2011-05-03 01:33:20 UTC ---
Fixed on trunk.  Will backport to 4.6 in a day or 2.


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

* [Bug fortran/48720] quad precision literals do not work
  2011-04-21 22:31 [Bug fortran/48720] New: quad precision literals do not work sliwa at blue dot cft.edu.pl
                   ` (8 preceding siblings ...)
  2011-05-03  1:34 ` kargl at gcc dot gnu.org
@ 2011-05-04 19:20 ` kargl at gcc dot gnu.org
  2011-05-04 19:26 ` kargl at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: kargl at gcc dot gnu.org @ 2011-05-04 19:20 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #11 from kargl at gcc dot gnu.org 2011-05-04 19:20:22 UTC ---
Fixed on 4.6 branch. Closing.  Thanks for the bug report.


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

* [Bug fortran/48720] quad precision literals do not work
  2011-04-21 22:31 [Bug fortran/48720] New: quad precision literals do not work sliwa at blue dot cft.edu.pl
                   ` (9 preceding siblings ...)
  2011-05-04 19:20 ` kargl at gcc dot gnu.org
@ 2011-05-04 19:26 ` kargl at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: kargl at gcc dot gnu.org @ 2011-05-04 19:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from kargl at gcc dot gnu.org 2011-05-04 19:18:04 UTC ---
Author: kargl
Date: Wed May  4 19:18:01 2011
New Revision: 173392

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173392
Log:
2011-05-04  Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/48720
        * gfortran.texi: Document the 'Q' exponent-letter extension.
        * invoke.texi: Document -Wreal-q-constant.
        * lang.opt: Add -Wreal-q-constant option.
        * gfortran.h: Add warn_real_q_constant to option struct.
        * primary.c (match_real_constant):  Use it.  Accept 'Q' as
        exponent-letter for REAL(16) real-literal-constant with a
        fallback to REAL(10) or error if REAL(10) is not available.
        * options.c (gfc_init_options, set_Wall) Set it.
        (gfc_handle_option): Handle new option.

Modified:
    branches/gcc-4_6-branch/gcc/fortran/ChangeLog
    branches/gcc-4_6-branch/gcc/fortran/gfortran.h
    branches/gcc-4_6-branch/gcc/fortran/gfortran.texi
    branches/gcc-4_6-branch/gcc/fortran/invoke.texi
    branches/gcc-4_6-branch/gcc/fortran/lang.opt
    branches/gcc-4_6-branch/gcc/fortran/options.c
    branches/gcc-4_6-branch/gcc/fortran/primary.c


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

end of thread, other threads:[~2011-05-04 19:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-21 22:31 [Bug fortran/48720] New: quad precision literals do not work sliwa at blue dot cft.edu.pl
2011-04-21 22:33 ` [Bug fortran/48720] " sliwa at blue dot cft.edu.pl
2011-04-22  2:22 ` jvdelisle at gcc dot gnu.org
2011-04-22  4:08 ` kargl at gcc dot gnu.org
2011-04-22 12:47 ` jvdelisle at frontier dot com
2011-04-22 15:01 ` sgk at troutmask dot apl.washington.edu
2011-04-22 15:16 ` sgk at troutmask dot apl.washington.edu
2011-04-25 18:45 ` kargl at gcc dot gnu.org
2011-05-03  1:25 ` kargl at gcc dot gnu.org
2011-05-03  1:34 ` kargl at gcc dot gnu.org
2011-05-04 19:20 ` kargl at gcc dot gnu.org
2011-05-04 19:26 ` kargl 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).