public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/36186]  New: Wrong handling of BOZ in CMPLX
@ 2008-05-09  9:40 fxcoudert at gcc dot gnu dot org
  2008-05-09  9:41 ` [Bug fortran/36186] " fxcoudert at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-05-09  9:40 UTC (permalink / raw)
  To: gcc-bugs

$ cat a.f90
program test0
   implicit none
   integer :: x = 1
   write(*,*) cmplx(b'01000000001010010101001111111101',1,4)
   write(*,*) cmplx(b'01000000001010010101001111111101',x,4)
end program test0
$ gfortran a.f90
$ ./a.out
 (  2.6457512    , 1.00000000    )
 ( 1.07645030E+09, 1.00000000    )

This is because we don't simplify the second case, and then we convert the boz,
which is represented as a maximal-size integer, into a real; as the integer is
too long, that doesn't work.

I believe it's the only place that can happen, as for other intrinsics, there
*always* is simplification in such a case. What we should do is not too clear
to me, maybe a BOZ expert could help: one thing possible is to trap that case
in the simplification routine, and even if we can't simplify the whole
intrinsic, we silently convert the BOZ there; or we take care of it in
trans-intrinsic.c.


-- 
           Summary: Wrong handling of BOZ in CMPLX
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fxcoudert at gcc dot gnu dot org


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


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

* [Bug fortran/36186] Wrong handling of BOZ in CMPLX
  2008-05-09  9:40 [Bug fortran/36186] New: Wrong handling of BOZ in CMPLX fxcoudert at gcc dot gnu dot org
@ 2008-05-09  9:41 ` fxcoudert at gcc dot gnu dot org
  2008-05-14 21:37 ` fxcoudert at gcc dot gnu dot org
  2008-05-14 21:38 ` fxcoudert at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-05-09  9:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from fxcoudert at gcc dot gnu dot org  2008-05-09 09:40 -------
And a related issue:

program test0
   implicit none
   integer :: x = 0
   write(*,*) cmplx(b'101000000001010010101001111111101',x,4)
end program test0

This should error with "BOZ constant at (1) is too large (33 vs 32 bits)", as
we do for other cases, but it doesn't. This seems to imply we really should
take care of all this in the simplification routine (convert the BOZ).


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |fxcoudert at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-05-09 09:40:29
               date|                            |


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


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

* [Bug fortran/36186] Wrong handling of BOZ in CMPLX
  2008-05-09  9:40 [Bug fortran/36186] New: Wrong handling of BOZ in CMPLX fxcoudert at gcc dot gnu dot org
  2008-05-09  9:41 ` [Bug fortran/36186] " fxcoudert at gcc dot gnu dot org
@ 2008-05-14 21:37 ` fxcoudert at gcc dot gnu dot org
  2008-05-14 21:38 ` fxcoudert at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-05-14 21:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from fxcoudert at gcc dot gnu dot org  2008-05-14 21:37 -------
Subject: Bug 36186

Author: fxcoudert
Date: Wed May 14 21:36:26 2008
New Revision: 135308

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=135308
Log:
        PR fortran/36186

        * simplify.c (only_convert_cmplx_boz): New function.
        (gfc_simplify_cmplx, gfc_simplify_complex, gfc_simplify_dcmplx):
        Call only_convert_cmplx_boz.

        * gfortran.dg/boz_11.f90: New test.
        * gfortran.dg/boz_12.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/boz_11.f90
    trunk/gcc/testsuite/gfortran.dg/boz_12.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/simplify.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/36186] Wrong handling of BOZ in CMPLX
  2008-05-09  9:40 [Bug fortran/36186] New: Wrong handling of BOZ in CMPLX fxcoudert at gcc dot gnu dot org
  2008-05-09  9:41 ` [Bug fortran/36186] " fxcoudert at gcc dot gnu dot org
  2008-05-14 21:37 ` fxcoudert at gcc dot gnu dot org
@ 2008-05-14 21:38 ` fxcoudert at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-05-14 21:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from fxcoudert at gcc dot gnu dot org  2008-05-14 21:37 -------
Fixed on 4.4.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.4.0


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


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

end of thread, other threads:[~2008-05-14 21:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-09  9:40 [Bug fortran/36186] New: Wrong handling of BOZ in CMPLX fxcoudert at gcc dot gnu dot org
2008-05-09  9:41 ` [Bug fortran/36186] " fxcoudert at gcc dot gnu dot org
2008-05-14 21:37 ` fxcoudert at gcc dot gnu dot org
2008-05-14 21:38 ` fxcoudert at gcc dot gnu dot 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).