public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32554]  New: [4.3 regression] Bug in P formatting
@ 2007-06-29 23:30 anlauf at gmx dot de
  2007-06-29 23:41 ` [Bug fortran/32554] " jvdelisle at gcc dot gnu dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: anlauf at gmx dot de @ 2007-06-29 23:30 UTC (permalink / raw)
  To: gcc-bugs

Hi,

the following code:

program gfcbug66
  real(8) :: x = 1.0e-100_8
  write (*,'(1X,2E12.3)')    x, 2 * x
  write (*,'(1X,1P,2E12.3)') x, 2 * x   ! Second printed number is wrong
end program gfcbug66

produces:

    0.100E-99   0.200E-99
    1.000-100   2.000E-10

but it should be

    0.100E-99   0.200E-99
    1.000-100   2.000-100

This used to work before and with 4.2.

Cheers,
-ha


-- 
           Summary: [4.3 regression] Bug in P formatting
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anlauf at gmx dot de
  GCC host triplet: i686-pc-linux-gnu


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


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

* [Bug fortran/32554] [4.3 regression] Bug in P formatting
  2007-06-29 23:30 [Bug fortran/32554] New: [4.3 regression] Bug in P formatting anlauf at gmx dot de
@ 2007-06-29 23:41 ` jvdelisle at gcc dot gnu dot org
  2007-06-30  0:05 ` jvdelisle at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-06-29 23:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jvdelisle at gcc dot gnu dot org  2007-06-29 23:41 -------
Confirmed. I will take this one. Hmm.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jvdelisle at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-06-29 23:41:47
               date|                            |


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


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

* [Bug fortran/32554] [4.3 regression] Bug in P formatting
  2007-06-29 23:30 [Bug fortran/32554] New: [4.3 regression] Bug in P formatting anlauf at gmx dot de
  2007-06-29 23:41 ` [Bug fortran/32554] " jvdelisle at gcc dot gnu dot org
@ 2007-06-30  0:05 ` jvdelisle at gcc dot gnu dot org
  2007-06-30  0:20 ` jvdelisle at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-06-30  0:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jvdelisle at gcc dot gnu dot org  2007-06-30 00:05 -------
I have traced to this patch, the change in write.c:

http://gcc.gnu.org/viewcvs?view=rev&revision=125100

Added Janne to cc


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jb at gcc dot gnu dot org


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


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

* [Bug fortran/32554] [4.3 regression] Bug in P formatting
  2007-06-29 23:30 [Bug fortran/32554] New: [4.3 regression] Bug in P formatting anlauf at gmx dot de
  2007-06-29 23:41 ` [Bug fortran/32554] " jvdelisle at gcc dot gnu dot org
  2007-06-30  0:05 ` jvdelisle at gcc dot gnu dot org
@ 2007-06-30  0:20 ` jvdelisle at gcc dot gnu dot org
  2007-06-30  0:32 ` kargl at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-06-30  0:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jvdelisle at gcc dot gnu dot org  2007-06-30 00:20 -------
This appears to fix it but I am not sure yet.  More testing.

Index: write.c
===================================================================
--- write.c     (revision 126131)
+++ write.c     (working copy)
@@ -546,7 +546,7 @@ output_float (st_parameter_dt *dtp, cons
    *   digits; if the value is zero, the exponent is 00.
    */
 #ifdef HAVE_SNPRINTF
-  snprintf (buffer, sizeof (buffer), "%+-#" STR(MIN_FIELD_WIDTH) ".*"
+  snprintf (buffer, sizeof (buffer)+1, "%+-#" STR(MIN_FIELD_WIDTH) ".*"
           GFC_REAL_LARGEST_FORMAT "e", ndigits - 1, value);
 #else
   sprintf (buffer, "%+-#" STR(MIN_FIELD_WIDTH) ".*"


-- 


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


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

* [Bug fortran/32554] [4.3 regression] Bug in P formatting
  2007-06-29 23:30 [Bug fortran/32554] New: [4.3 regression] Bug in P formatting anlauf at gmx dot de
                   ` (2 preceding siblings ...)
  2007-06-30  0:20 ` jvdelisle at gcc dot gnu dot org
@ 2007-06-30  0:32 ` kargl at gcc dot gnu dot org
  2007-06-30  0:50 ` jvdelisle at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: kargl at gcc dot gnu dot org @ 2007-06-30  0:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from kargl at gcc dot gnu dot org  2007-06-30 00:32 -------
(In reply to comment #3)
> This appears to fix it but I am not sure yet.  More testing.
> 
>     */
>  #ifdef HAVE_SNPRINTF
> -  snprintf (buffer, sizeof (buffer), "%+-#" STR(MIN_FIELD_WIDTH) ".*"
> +  snprintf (buffer, sizeof (buffer)+1, "%+-#" STR(MIN_FIELD_WIDTH) ".*"
>            GFC_REAL_LARGEST_FORMAT "e", ndigits - 1, value);

Are you sure?  That looks like a buffer overflow.


-- 


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


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

* [Bug fortran/32554] [4.3 regression] Bug in P formatting
  2007-06-29 23:30 [Bug fortran/32554] New: [4.3 regression] Bug in P formatting anlauf at gmx dot de
                   ` (3 preceding siblings ...)
  2007-06-30  0:32 ` kargl at gcc dot gnu dot org
@ 2007-06-30  0:50 ` jvdelisle at gcc dot gnu dot org
  2007-06-30  5:03 ` jvdelisle at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-06-30  0:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jvdelisle at gcc dot gnu dot org  2007-06-30 00:50 -------
I agree, that's why I said I was not sure.  I am thinking this is pretty odd. 
I am going to test snprintf to see if its broken. sprintf works fine as is.


-- 


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


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

* [Bug fortran/32554] [4.3 regression] Bug in P formatting
  2007-06-29 23:30 [Bug fortran/32554] New: [4.3 regression] Bug in P formatting anlauf at gmx dot de
                   ` (4 preceding siblings ...)
  2007-06-30  0:50 ` jvdelisle at gcc dot gnu dot org
@ 2007-06-30  5:03 ` jvdelisle at gcc dot gnu dot org
  2007-06-30  9:21 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-06-30  5:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jvdelisle at gcc dot gnu dot org  2007-06-30 05:03 -------
There is an off by 1 error in the calculation of the number of digits.  This is
a latent bug uncovered by Janne's patch.  Patch is on its way.


-- 


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


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

* [Bug fortran/32554] [4.3 regression] Bug in P formatting
  2007-06-29 23:30 [Bug fortran/32554] New: [4.3 regression] Bug in P formatting anlauf at gmx dot de
                   ` (5 preceding siblings ...)
  2007-06-30  5:03 ` jvdelisle at gcc dot gnu dot org
@ 2007-06-30  9:21 ` pinskia at gcc dot gnu dot org
  2007-06-30 20:00 ` patchapp at dberlin dot org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-06-30  9:21 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.3.0


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


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

* [Bug fortran/32554] [4.3 regression] Bug in P formatting
  2007-06-29 23:30 [Bug fortran/32554] New: [4.3 regression] Bug in P formatting anlauf at gmx dot de
                   ` (6 preceding siblings ...)
  2007-06-30  9:21 ` pinskia at gcc dot gnu dot org
@ 2007-06-30 20:00 ` patchapp at dberlin dot org
  2007-07-01 15:46 ` jvdelisle at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: patchapp at dberlin dot org @ 2007-06-30 20:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from patchapp at dberlin dot org  2007-06-30 20:00 -------
Subject: Bug number PR32554

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-06/msg02162.html


-- 


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


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

* [Bug fortran/32554] [4.3 regression] Bug in P formatting
  2007-06-29 23:30 [Bug fortran/32554] New: [4.3 regression] Bug in P formatting anlauf at gmx dot de
                   ` (7 preceding siblings ...)
  2007-06-30 20:00 ` patchapp at dberlin dot org
@ 2007-07-01 15:46 ` jvdelisle at gcc dot gnu dot org
  2007-07-01 15:49 ` jvdelisle at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-07-01 15:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jvdelisle at gcc dot gnu dot org  2007-07-01 15:46 -------
Subject: Bug 32554

Author: jvdelisle
Date: Sun Jul  1 15:46:33 2007
New Revision: 126173

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126173
Log:
2007-07-01  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/32554
        * io/write.c (output_float): Set edigits to a fixed size, avoiding
        variation in field width calculation and eliminate buffer overrun.

Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/io/write.c


-- 


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


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

* [Bug fortran/32554] [4.3 regression] Bug in P formatting
  2007-06-29 23:30 [Bug fortran/32554] New: [4.3 regression] Bug in P formatting anlauf at gmx dot de
                   ` (8 preceding siblings ...)
  2007-07-01 15:46 ` jvdelisle at gcc dot gnu dot org
@ 2007-07-01 15:49 ` jvdelisle at gcc dot gnu dot org
  2007-07-02  4:11 ` [Bug fortran/32554] [4.2 Only] " jvdelisle at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-07-01 15:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jvdelisle at gcc dot gnu dot org  2007-07-01 15:49 -------
Subject: Bug 32554

Author: jvdelisle
Date: Sun Jul  1 15:49:37 2007
New Revision: 126174

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126174
Log:
2007-06-29  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/32554
        * gfortran.dg/fmt_p_1.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/fmt_p_1.f90
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/32554] [4.2 Only] Bug in P formatting
  2007-06-29 23:30 [Bug fortran/32554] New: [4.3 regression] Bug in P formatting anlauf at gmx dot de
                   ` (9 preceding siblings ...)
  2007-07-01 15:49 ` jvdelisle at gcc dot gnu dot org
@ 2007-07-02  4:11 ` jvdelisle at gcc dot gnu dot org
  2007-07-08  2:20 ` jvdelisle at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-07-02  4:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from jvdelisle at gcc dot gnu dot org  2007-07-02 04:11 -------
Fixed on 4.3, will backport to 4.2 in about a week.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.3 regression] Bug in P   |[4.2 Only] Bug in P
                   |formatting                  |formatting
   Target Milestone|4.3.0                       |4.2.2


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


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

* [Bug fortran/32554] [4.2 Only] Bug in P formatting
  2007-06-29 23:30 [Bug fortran/32554] New: [4.3 regression] Bug in P formatting anlauf at gmx dot de
                   ` (10 preceding siblings ...)
  2007-07-02  4:11 ` [Bug fortran/32554] [4.2 Only] " jvdelisle at gcc dot gnu dot org
@ 2007-07-08  2:20 ` jvdelisle at gcc dot gnu dot org
  2007-07-08  2:24 ` jvdelisle at gcc dot gnu dot org
  2007-07-08 17:10 ` jvdelisle at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-07-08  2:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from jvdelisle at gcc dot gnu dot org  2007-07-08 02:20 -------
Subject: Bug 32554

Author: jvdelisle
Date: Sun Jul  8 02:20:10 2007
New Revision: 126456

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126456
Log:
2007-07-07  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/32554
        Backport from trunk.
        * io/write.c (output_float): Set edigits to a fixed size, avoiding
        variation in field width calculation and eliminate buffer overrun.

Modified:
    branches/gcc-4_2-branch/libgfortran/ChangeLog
    branches/gcc-4_2-branch/libgfortran/io/write.c


-- 


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


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

* [Bug fortran/32554] [4.2 Only] Bug in P formatting
  2007-06-29 23:30 [Bug fortran/32554] New: [4.3 regression] Bug in P formatting anlauf at gmx dot de
                   ` (11 preceding siblings ...)
  2007-07-08  2:20 ` jvdelisle at gcc dot gnu dot org
@ 2007-07-08  2:24 ` jvdelisle at gcc dot gnu dot org
  2007-07-08 17:10 ` jvdelisle at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-07-08  2:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from jvdelisle at gcc dot gnu dot org  2007-07-08 02:24 -------
Subject: Bug 32554

Author: jvdelisle
Date: Sun Jul  8 02:24:37 2007
New Revision: 126457

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126457
Log:
2007-07-07  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/32554
        * gfortran.dg/fmt_p_1.f90: New test.

Added:
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/fmt_p_1.f90
Modified:
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/32554] [4.2 Only] Bug in P formatting
  2007-06-29 23:30 [Bug fortran/32554] New: [4.3 regression] Bug in P formatting anlauf at gmx dot de
                   ` (12 preceding siblings ...)
  2007-07-08  2:24 ` jvdelisle at gcc dot gnu dot org
@ 2007-07-08 17:10 ` jvdelisle at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-07-08 17:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from jvdelisle at gcc dot gnu dot org  2007-07-08 17:09 -------
Closing, fixed for 4.2


-- 

jvdelisle at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2007-07-08 17:10 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-29 23:30 [Bug fortran/32554] New: [4.3 regression] Bug in P formatting anlauf at gmx dot de
2007-06-29 23:41 ` [Bug fortran/32554] " jvdelisle at gcc dot gnu dot org
2007-06-30  0:05 ` jvdelisle at gcc dot gnu dot org
2007-06-30  0:20 ` jvdelisle at gcc dot gnu dot org
2007-06-30  0:32 ` kargl at gcc dot gnu dot org
2007-06-30  0:50 ` jvdelisle at gcc dot gnu dot org
2007-06-30  5:03 ` jvdelisle at gcc dot gnu dot org
2007-06-30  9:21 ` pinskia at gcc dot gnu dot org
2007-06-30 20:00 ` patchapp at dberlin dot org
2007-07-01 15:46 ` jvdelisle at gcc dot gnu dot org
2007-07-01 15:49 ` jvdelisle at gcc dot gnu dot org
2007-07-02  4:11 ` [Bug fortran/32554] [4.2 Only] " jvdelisle at gcc dot gnu dot org
2007-07-08  2:20 ` jvdelisle at gcc dot gnu dot org
2007-07-08  2:24 ` jvdelisle at gcc dot gnu dot org
2007-07-08 17:10 ` jvdelisle 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).