public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/36689]  New: PRINT and WRITE eat minus sign
@ 2008-07-01 15:13 dennis dot wassel at googlemail dot com
  2008-07-01 18:07 ` [Bug fortran/36689] " burnus at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: dennis dot wassel at googlemail dot com @ 2008-07-01 15:13 UTC (permalink / raw)
  To: gcc-bugs

Funny things abound... Negative numbers show up as positive, which can be
pretty -let's say- irritating in computational applications :)

I've managed to boil this down to the following example

PROGRAM Minus

  implicit none
  integer :: N
  real, pointer, dimension(:) :: XP => NULL()

  N = 2
  allocate(XP(N))

  XP = +1.23
  print *, "pos X = ", XP
  XP = -1.23
  print *, "neg X = ", XP

  print *, "zero = ", XP+1.23

END PROGRAM Minus

which produces the following output on an OpenSolaris 11 machine (note the
additional space)

 pos X =    1.2300000       1.2300000
 neg X =   1.23000002      1.23000002
 zero =    0.0000000       0.0000000

gfortran about himself (or itself?):
Target: i386-pc-solaris2.11
Configured with: ../gcc-4.3.1/configure --prefix=/usr/local/lang
--program-suffix=_4.3.1 --enable-64bit --with-as=/usr/local/bin/gnu-as
--with-ld=/usr/ccs/bin/ld --enable-version-specific-runtime-libs
--enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.3.1 (GCC)

Any pointers?


-- 
           Summary: PRINT and WRITE eat minus sign
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dennis dot wassel at googlemail dot com
  GCC host triplet: i386-pc-solaris2.11
GCC target triplet: i386-pc-solaris2.11


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


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

* [Bug fortran/36689] PRINT and WRITE eat minus sign
  2008-07-01 15:13 [Bug fortran/36689] New: PRINT and WRITE eat minus sign dennis dot wassel at googlemail dot com
@ 2008-07-01 18:07 ` burnus at gcc dot gnu dot org
  2008-07-01 19:33 ` jvdelisle at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-07-01 18:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2008-07-01 18:06 -------
Not that it helps much, but on x86-64-linux I cannot reproduce this using GCC
4.1, 4.2, 4.3.1 and 4.4.0(of today). Though I agree that the bug is irritating.


-- 


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


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

* [Bug fortran/36689] PRINT and WRITE eat minus sign
  2008-07-01 15:13 [Bug fortran/36689] New: PRINT and WRITE eat minus sign dennis dot wassel at googlemail dot com
  2008-07-01 18:07 ` [Bug fortran/36689] " burnus at gcc dot gnu dot org
@ 2008-07-01 19:33 ` jvdelisle at gcc dot gnu dot org
  2008-07-01 22:56 ` dennis dot wassel at googlemail dot com
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2008-07-01 19:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jvdelisle at gcc dot gnu dot org  2008-07-01 19:32 -------
Do you see the problem if XP is not declared a pointer?


-- 


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


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

* [Bug fortran/36689] PRINT and WRITE eat minus sign
  2008-07-01 15:13 [Bug fortran/36689] New: PRINT and WRITE eat minus sign dennis dot wassel at googlemail dot com
  2008-07-01 18:07 ` [Bug fortran/36689] " burnus at gcc dot gnu dot org
  2008-07-01 19:33 ` jvdelisle at gcc dot gnu dot org
@ 2008-07-01 22:56 ` dennis dot wassel at googlemail dot com
  2008-07-02  8:54 ` dennis dot wassel at googlemail dot com
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: dennis dot wassel at googlemail dot com @ 2008-07-01 22:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dennis dot wassel at googlemail dot com  2008-07-01 22:55 -------
(In reply to comment #1)
> Not that it helps much, but on x86-64-linux I cannot reproduce this using GCC
> 4.1, 4.2, 4.3.1 and 4.4.0(of today). Though I agree that the bug is
> irritating.

Same with me, works like a treat on x86-linux with 4.3.1.


(In reply to comment #2)
> Do you see the problem if XP is not declared a pointer?

The problem seems to remain the same, regardless of the type of array of XP,
that is allocatable or fixed-size (compile-time).
Stupid I didn't check this earlier...


-- 


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


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

* [Bug fortran/36689] PRINT and WRITE eat minus sign
  2008-07-01 15:13 [Bug fortran/36689] New: PRINT and WRITE eat minus sign dennis dot wassel at googlemail dot com
                   ` (2 preceding siblings ...)
  2008-07-01 22:56 ` dennis dot wassel at googlemail dot com
@ 2008-07-02  8:54 ` dennis dot wassel at googlemail dot com
  2008-07-02 14:28 ` jvdelisle at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: dennis dot wassel at googlemail dot com @ 2008-07-02  8:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dennis dot wassel at googlemail dot com  2008-07-02 08:54 -------
> (In reply to myself)
> The problem seems to remain the same, regardless of the type of array of XP,
> that is allocatable or fixed-size (compile-time).
> Stupid I didn't check this earlier...

Out of curiosity, I tried turning XP into a scalar. Still no signs of any minus
signs.


-- 


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


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

* [Bug fortran/36689] PRINT and WRITE eat minus sign
  2008-07-01 15:13 [Bug fortran/36689] New: PRINT and WRITE eat minus sign dennis dot wassel at googlemail dot com
                   ` (3 preceding siblings ...)
  2008-07-02  8:54 ` dennis dot wassel at googlemail dot com
@ 2008-07-02 14:28 ` jvdelisle at gcc dot gnu dot org
  2008-07-02 14:39 ` dennis dot wassel at googlemail dot com
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2008-07-02 14:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jvdelisle at gcc dot gnu dot org  2008-07-02 14:27 -------
To debug this we will probably need to get remote ssh access to a machine like
this.  I can think of three possible causes of the problem at the moment.

1) The executable is accessing the wrong version of libgfortran. You might need
to set LD_LIBRARY_PATH.

2) The system has a broken printf or memory allocation.

3) Some sort of endianess or sizeof issue.  For example, in some places in the
gfortran runtime library, characters are stored in type int.  When moving bytes
around, an overwrite of the least signigicant byte may be happening.

Send me private email if you can give access to machine.


-- 


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


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

* [Bug fortran/36689] PRINT and WRITE eat minus sign
  2008-07-01 15:13 [Bug fortran/36689] New: PRINT and WRITE eat minus sign dennis dot wassel at googlemail dot com
                   ` (4 preceding siblings ...)
  2008-07-02 14:28 ` jvdelisle at gcc dot gnu dot org
@ 2008-07-02 14:39 ` dennis dot wassel at googlemail dot com
  2008-07-02 15:01 ` dennis dot wassel at googlemail dot com
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: dennis dot wassel at googlemail dot com @ 2008-07-02 14:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from dennis dot wassel at googlemail dot com  2008-07-02 14:39 -------
(In reply to comment #5)

> 1) The executable is accessing the wrong version of libgfortran. You might 
> need to set LD_LIBRARY_PATH.

Nope, everything in order here, as far as I can tell:

isaac:/tmp$ ldd minus
        libgfortran.so.3 =>
/usr/local/lang/lib/gcc/i386-pc-solaris2.11/4.3.1/libgfortran.so.3
        libm.so.2 =>     /lib/libm.so.2
        libgcc_s.so.1 =>        
/usr/local/lang/lib/gcc/i386-pc-solaris2.11/4.3.1/libgcc_s.so.1
        libc.so.1 =>     /lib/libc.so.1

> 
> Send me private email if you can give access to machine.
> 

Aye, will see what I can do.


-- 


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


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

* [Bug fortran/36689] PRINT and WRITE eat minus sign
  2008-07-01 15:13 [Bug fortran/36689] New: PRINT and WRITE eat minus sign dennis dot wassel at googlemail dot com
                   ` (5 preceding siblings ...)
  2008-07-02 14:39 ` dennis dot wassel at googlemail dot com
@ 2008-07-02 15:01 ` dennis dot wassel at googlemail dot com
  2008-07-08 15:51 ` jvdelisle at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: dennis dot wassel at googlemail dot com @ 2008-07-02 15:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from dennis dot wassel at googlemail dot com  2008-07-02 15:00 -------
(In reply to comment #5)
>
> 2) The system has a broken printf or memory allocation.
>

printf seems to be fine. If I compile and link this snippet of C

#include <stdio.h>
void cprint_(float *x) {
  printf("with printf X = %12.8f\n", *x);
}

into my Fortran code

PROGRAM Minus

  implicit none
  real :: XP

  XP = +1.23
  print *, "pos X = ", XP
  call cprint(xp)

  XP = -1.23
  print *, "neg X = ", XP
  call cprint(xp)

  print *, "zero = ", XP+1.23

END PROGRAM Minus

the output is
 pos X =    1.2300000
with printf X =   1.23000002
 neg X =   1.23000002
with printf X =  -1.23000002
 zero =    0.0000000


Ho-hum. Memory allocation? It's not even an array any more, could that still be
an issue?

Won't be able to give you access to that machine before tomorrow.


-- 


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


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

* [Bug fortran/36689] PRINT and WRITE eat minus sign
  2008-07-01 15:13 [Bug fortran/36689] New: PRINT and WRITE eat minus sign dennis dot wassel at googlemail dot com
                   ` (6 preceding siblings ...)
  2008-07-02 15:01 ` dennis dot wassel at googlemail dot com
@ 2008-07-08 15:51 ` jvdelisle at gcc dot gnu dot org
  2008-07-08 17:11 ` dennis dot wassel at googlemail dot com
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2008-07-08 15:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jvdelisle at gcc dot gnu dot org  2008-07-08 15:50 -------
I have remote access to the machine now. Having trouble with gcc build.  Not
forgotton.


-- 


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


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

* [Bug fortran/36689] PRINT and WRITE eat minus sign
  2008-07-01 15:13 [Bug fortran/36689] New: PRINT and WRITE eat minus sign dennis dot wassel at googlemail dot com
                   ` (7 preceding siblings ...)
  2008-07-08 15:51 ` jvdelisle at gcc dot gnu dot org
@ 2008-07-08 17:11 ` dennis dot wassel at googlemail dot com
  2009-04-30  9:52 ` [Bug libfortran/36689] " pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: dennis dot wassel at googlemail dot com @ 2008-07-08 17:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from dennis dot wassel at googlemail dot com  2008-07-08 17:10 -------
(In reply to comment #8)
> I have remote access to the machine now. Having trouble with gcc build.  Not
> forgotton.

I remember our admin talking about needing an updated ld to be able to compile
gcc. Are you aware of anything in that direction?


-- 


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


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

* [Bug libfortran/36689] PRINT and WRITE eat minus sign
  2008-07-01 15:13 [Bug fortran/36689] New: PRINT and WRITE eat minus sign dennis dot wassel at googlemail dot com
                   ` (8 preceding siblings ...)
  2008-07-08 17:11 ` dennis dot wassel at googlemail dot com
@ 2009-04-30  9:52 ` pault at gcc dot gnu dot org
  2009-04-30 10:31 ` dennis dot wassel at googlemail dot com
  2009-04-30 12:45 ` dennis dot wassel at googlemail dot com
  11 siblings, 0 replies; 13+ messages in thread
From: pault at gcc dot gnu dot org @ 2009-04-30  9:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pault at gcc dot gnu dot org  2009-04-30 09:52 -------
(In reply to comment #9)
> (In reply to comment #8)
> > I have remote access to the machine now. Having trouble with gcc build.  Not
> > forgotton.
> 
> I remember our admin talking about needing an updated ld to be able to compile
> gcc. Are you aware of anything in that direction?
> 

Where are we with this one, Dennis and Jerry?

Paul


-- 


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


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

* [Bug libfortran/36689] PRINT and WRITE eat minus sign
  2008-07-01 15:13 [Bug fortran/36689] New: PRINT and WRITE eat minus sign dennis dot wassel at googlemail dot com
                   ` (9 preceding siblings ...)
  2009-04-30  9:52 ` [Bug libfortran/36689] " pault at gcc dot gnu dot org
@ 2009-04-30 10:31 ` dennis dot wassel at googlemail dot com
  2009-04-30 12:45 ` dennis dot wassel at googlemail dot com
  11 siblings, 0 replies; 13+ messages in thread
From: dennis dot wassel at googlemail dot com @ 2009-04-30 10:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from dennis dot wassel at googlemail dot com  2009-04-30 10:31 -------
It is working with 4.3.3, so it seems to have been silently fixed somewhere.


-- 


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


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

* [Bug libfortran/36689] PRINT and WRITE eat minus sign
  2008-07-01 15:13 [Bug fortran/36689] New: PRINT and WRITE eat minus sign dennis dot wassel at googlemail dot com
                   ` (10 preceding siblings ...)
  2009-04-30 10:31 ` dennis dot wassel at googlemail dot com
@ 2009-04-30 12:45 ` dennis dot wassel at googlemail dot com
  11 siblings, 0 replies; 13+ messages in thread
From: dennis dot wassel at googlemail dot com @ 2009-04-30 12:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from dennis dot wassel at googlemail dot com  2009-04-30 12:44 -------
Closing, works with 4.3.3


-- 

dennis dot wassel at googlemail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WORKSFORME


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


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

end of thread, other threads:[~2009-04-30 12:45 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-01 15:13 [Bug fortran/36689] New: PRINT and WRITE eat minus sign dennis dot wassel at googlemail dot com
2008-07-01 18:07 ` [Bug fortran/36689] " burnus at gcc dot gnu dot org
2008-07-01 19:33 ` jvdelisle at gcc dot gnu dot org
2008-07-01 22:56 ` dennis dot wassel at googlemail dot com
2008-07-02  8:54 ` dennis dot wassel at googlemail dot com
2008-07-02 14:28 ` jvdelisle at gcc dot gnu dot org
2008-07-02 14:39 ` dennis dot wassel at googlemail dot com
2008-07-02 15:01 ` dennis dot wassel at googlemail dot com
2008-07-08 15:51 ` jvdelisle at gcc dot gnu dot org
2008-07-08 17:11 ` dennis dot wassel at googlemail dot com
2009-04-30  9:52 ` [Bug libfortran/36689] " pault at gcc dot gnu dot org
2009-04-30 10:31 ` dennis dot wassel at googlemail dot com
2009-04-30 12:45 ` dennis dot wassel at googlemail dot com

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