public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/98701] New: I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10.  I get two very different results for identical input files with the results from the one compiled by gfortran being wrong.
@ 2021-01-15 20:47 Bahram.shahrooz at uc dot edu
  2021-01-15 22:13 ` [Bug fortran/98701] " kargl at gcc dot gnu.org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: Bahram.shahrooz at uc dot edu @ 2021-01-15 20:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98701

            Bug ID: 98701
           Summary: I compiled a program with gfortran on Mac (Big Sur,
                    version 11.1) and g77 on Windows 10.  I get two very
                    different results for identical input files with the
                    results from the one compiled by gfortran being wrong.
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Bahram.shahrooz at uc dot edu
  Target Milestone: ---

Created attachment 49978
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49978&action=edit
report from gfortran

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

* [Bug fortran/98701] I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10.  I get two very different results for identical input files with the results from the one compiled by gfortran being wrong.
  2021-01-15 20:47 [Bug fortran/98701] New: I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10. I get two very different results for identical input files with the results from the one compiled by gfortran being wrong Bahram.shahrooz at uc dot edu
@ 2021-01-15 22:13 ` kargl at gcc dot gnu.org
  2021-01-15 23:48 ` jakub at gcc dot gnu.org
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-01-15 22:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98701

kargl at gcc dot gnu.org changed:

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

--- Comment #1 from kargl at gcc dot gnu.org ---
We need
1) Course code and input file
2) Expected output generated by g77 on Windows 10.  Command line used to
   compile code.
3) Output you go on Mac.

With gfortran, try compiling with -fcheck=all -ffpe-trap=zero,invalid

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

* [Bug fortran/98701] I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10.  I get two very different results for identical input files with the results from the one compiled by gfortran being wrong.
  2021-01-15 20:47 [Bug fortran/98701] New: I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10. I get two very different results for identical input files with the results from the one compiled by gfortran being wrong Bahram.shahrooz at uc dot edu
  2021-01-15 22:13 ` [Bug fortran/98701] " kargl at gcc dot gnu.org
@ 2021-01-15 23:48 ` jakub at gcc dot gnu.org
  2021-01-16  0:30 ` Bahram.shahrooz at uc dot edu
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-15 23:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98701

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
And given the warnings, if the code uses exact floating point comparisons, it
might behave differently if there is even 1 ulp difference (which is quite
possible on a lot of code).

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

* [Bug fortran/98701] I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10.  I get two very different results for identical input files with the results from the one compiled by gfortran being wrong.
  2021-01-15 20:47 [Bug fortran/98701] New: I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10. I get two very different results for identical input files with the results from the one compiled by gfortran being wrong Bahram.shahrooz at uc dot edu
  2021-01-15 22:13 ` [Bug fortran/98701] " kargl at gcc dot gnu.org
  2021-01-15 23:48 ` jakub at gcc dot gnu.org
@ 2021-01-16  0:30 ` Bahram.shahrooz at uc dot edu
  2021-01-16  0:41 ` Bahram.shahrooz at uc dot edu
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Bahram.shahrooz at uc dot edu @ 2021-01-16  0:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98701

--- Comment #3 from Bahram.shahrooz at uc dot edu ---
Created attachment 49979
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49979&action=edit
source code

Sorry, I had to zip several files. Readme file in Archive.zip explains what the
files are.

Here's how I compiled:

gfortran FiberAnalysis.f -o0 -o FiberAnalysis

g77 -o0 FiberAnalysis.f -o FiberAnalysis

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

* [Bug fortran/98701] I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10.  I get two very different results for identical input files with the results from the one compiled by gfortran being wrong.
  2021-01-15 20:47 [Bug fortran/98701] New: I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10. I get two very different results for identical input files with the results from the one compiled by gfortran being wrong Bahram.shahrooz at uc dot edu
                   ` (2 preceding siblings ...)
  2021-01-16  0:30 ` Bahram.shahrooz at uc dot edu
@ 2021-01-16  0:41 ` Bahram.shahrooz at uc dot edu
  2021-01-16  0:45 ` sgk at troutmask dot apl.washington.edu
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Bahram.shahrooz at uc dot edu @ 2021-01-16  0:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98701

--- Comment #4 from Bahram.shahrooz at uc dot edu ---
I compiled with the suggested options (below) and now the code gives the same
result as g77.

-fcheck=all -ffpe-trap=zero,invalid

Things look good now!

Sorry for starting this bug report prematurely, and many thanks for your
help!!!

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

* [Bug fortran/98701] I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10.  I get two very different results for identical input files with the results from the one compiled by gfortran being wrong.
  2021-01-15 20:47 [Bug fortran/98701] New: I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10. I get two very different results for identical input files with the results from the one compiled by gfortran being wrong Bahram.shahrooz at uc dot edu
                   ` (3 preceding siblings ...)
  2021-01-16  0:41 ` Bahram.shahrooz at uc dot edu
@ 2021-01-16  0:45 ` sgk at troutmask dot apl.washington.edu
  2021-01-16  0:51 ` Bahram.shahrooz at uc dot edu
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2021-01-16  0:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98701

--- Comment #5 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Sat, Jan 16, 2021 at 12:41:56AM +0000, Bahram.shahrooz at uc dot edu wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98701
> 
> --- Comment #4 from Bahram.shahrooz at uc dot edu ---
> I compiled with the suggested options (below) and now the code gives the same
> result as g77.
> 
> -fcheck=all -ffpe-trap=zero,invalid
> 
> Things look good now!
> 

Those options should not fix the code.  Those should
find the error.  If you compile without these options,
do you then get wrong results.  Also, what do you 
expect.  On my system, I see

      Moment      Axial_Load
   1470.43183     134.34887
   1564.87796     144.02005
   1643.96121     152.13968
   1708.47908     158.75645
   1749.07356     162.94978

for the first few lines.

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

* [Bug fortran/98701] I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10.  I get two very different results for identical input files with the results from the one compiled by gfortran being wrong.
  2021-01-15 20:47 [Bug fortran/98701] New: I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10. I get two very different results for identical input files with the results from the one compiled by gfortran being wrong Bahram.shahrooz at uc dot edu
                   ` (4 preceding siblings ...)
  2021-01-16  0:45 ` sgk at troutmask dot apl.washington.edu
@ 2021-01-16  0:51 ` Bahram.shahrooz at uc dot edu
  2021-01-16  1:21 ` sgk at troutmask dot apl.washington.edu
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Bahram.shahrooz at uc dot edu @ 2021-01-16  0:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98701

--- Comment #6 from Bahram.shahrooz at uc dot edu ---
I get wrong answers doing this:

gfortran FiberAnalysis.f -o FiberAnalysis

I get correct answers doing this:

gfortran FiberAnalysis.f -fcheck=all -ffpe-trap=zero,invalid -o FiberAnalysis

   Moment      Axial_Load
   3244.08910    -215.38970
   3432.22199    -190.65966
   3594.93500    -168.86785
   3734.50302    -149.77519
   3842.77168    -134.14558
   3986.24344    -114.80934
   4115.25069     -97.21038
   4230.37015     -81.27311
   4323.74191     -67.84354
   4442.09009     -51.57463
   4551.67144     -36.41379
   4653.40529     -22.24901
   4748.46682      -8.91886
   4844.11684       4.77310
   4933.55651      17.64818
   5017.35901      29.77892
   5097.44257      41.41472
   5193.49624      55.17913
   5275.53074      67.17330
   5351.16344      78.34124

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

* [Bug fortran/98701] I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10.  I get two very different results for identical input files with the results from the one compiled by gfortran being wrong.
  2021-01-15 20:47 [Bug fortran/98701] New: I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10. I get two very different results for identical input files with the results from the one compiled by gfortran being wrong Bahram.shahrooz at uc dot edu
                   ` (5 preceding siblings ...)
  2021-01-16  0:51 ` Bahram.shahrooz at uc dot edu
@ 2021-01-16  1:21 ` sgk at troutmask dot apl.washington.edu
  2021-01-16  1:32 ` sgk at troutmask dot apl.washington.edu
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2021-01-16  1:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98701

--- Comment #7 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Sat, Jan 16, 2021 at 12:51:38AM +0000, Bahram.shahrooz at uc dot edu wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98701
> 
> --- Comment #6 from Bahram.shahrooz at uc dot edu ---
> I get wrong answers doing this:
> 
> gfortran FiberAnalysis.f -o FiberAnalysis
> 
> I get correct answers doing this:
> 
> gfortran FiberAnalysis.f -fcheck=all -ffpe-trap=zero,invalid -o FiberAnalysis
> 

Your code is broken.  I added -freal-init=nan to initialize
all variables to an NaN.  The compiled program dies, and the debugger
shows

% gdb ./z z.core
Program terminated with signal SIGFPE, Arithmetic exception.
#0  0x08049476 in fsteel1 (es=nan(0x8000000000000), fs=nan(0x8000000000000), 
    ibuckle=0) at FiberAnalysis.f:387
387           if(es.ge.0.0) go to 10
(gdb) p es
$1 = nan(0x8000000000000)

If I reduce the loop 'do 3000 na=1,500' by 1, i.e., I use
'do 3000 na=1,499', then the computation dies at

(gdb) bt
#0  0x0804e323 in fiberanalysis () at FiberAnalysis.f:313
#1  0x0804ed63 in main (argc=1, argv=0xffbfe864) at FiberAnalysis.f:361
#2  0x08048a37 in _start1 ()
#3  0x08048b90 in _start ()

Line 313 is 

      if(xp(k).ne.0.and.xp(k).ge.xpmin) then

and 

(gdb) p xp(500)
$4 = nan(0x8000000000000)
(gdb) p xp(499)
$5 = 2425.0013590651233

If I reduce the loop to 498, it then dies at

Program terminated with signal SIGFPE, Arithmetic exception.
#0  0x0804e08b in fiberanalysis () at FiberAnalysis.f:302
302           if(xp(k).lt.xpmin) then
(gdb) p xp(498)
$1 = 2424.590579331998
(gdb) p xp(499)
$2 = nan(0x8000000000000)

You're using undefined variables.

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

* [Bug fortran/98701] I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10.  I get two very different results for identical input files with the results from the one compiled by gfortran being wrong.
  2021-01-15 20:47 [Bug fortran/98701] New: I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10. I get two very different results for identical input files with the results from the one compiled by gfortran being wrong Bahram.shahrooz at uc dot edu
                   ` (6 preceding siblings ...)
  2021-01-16  1:21 ` sgk at troutmask dot apl.washington.edu
@ 2021-01-16  1:32 ` sgk at troutmask dot apl.washington.edu
  2021-01-16  4:48 ` Bahram.shahrooz at uc dot edu
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2021-01-16  1:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98701

--- Comment #8 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Fri, Jan 15, 2021 at 05:21:22PM -0800, Steve Kargl wrote:
> 
> You're using undefined variables.
> 

I little more debugging, 

      read(5,*) estrt,esfinal,eincr
      if(eincr.gt.0) xnumber=(esfinal-estart)/eincr

estart is undefined here.  I suspect you want estrt.

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

* [Bug fortran/98701] I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10.  I get two very different results for identical input files with the results from the one compiled by gfortran being wrong.
  2021-01-15 20:47 [Bug fortran/98701] New: I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10. I get two very different results for identical input files with the results from the one compiled by gfortran being wrong Bahram.shahrooz at uc dot edu
                   ` (7 preceding siblings ...)
  2021-01-16  1:32 ` sgk at troutmask dot apl.washington.edu
@ 2021-01-16  4:48 ` Bahram.shahrooz at uc dot edu
  2021-01-16  6:52 ` sgk at troutmask dot apl.washington.edu
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Bahram.shahrooz at uc dot edu @ 2021-01-16  4:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98701

--- Comment #9 from Bahram.shahrooz at uc dot edu ---
Yes, thank you for finding this bug. Things didn't change after changing estart
to estrt. 

Sorry, I don't know how to use -freal-init=nan.  I tried to use it like this
but got an error.

% gfortran FiberAnalysis.f -freal-init=nan -o FiberAnalysis

gfortran: error: unrecognized command-line option '-freal-init=nan'

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

* [Bug fortran/98701] I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10.  I get two very different results for identical input files with the results from the one compiled by gfortran being wrong.
  2021-01-15 20:47 [Bug fortran/98701] New: I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10. I get two very different results for identical input files with the results from the one compiled by gfortran being wrong Bahram.shahrooz at uc dot edu
                   ` (8 preceding siblings ...)
  2021-01-16  4:48 ` Bahram.shahrooz at uc dot edu
@ 2021-01-16  6:52 ` sgk at troutmask dot apl.washington.edu
  2021-01-16 23:20 ` Bahram.shahrooz at uc dot edu
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2021-01-16  6:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98701

--- Comment #10 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Sat, Jan 16, 2021 at 04:48:09AM +0000, Bahram.shahrooz at uc dot edu wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98701
> 
> --- Comment #9 from Bahram.shahrooz at uc dot edu ---
> Yes, thank you for finding this bug. Things didn't change after changing estart
> to estrt. 
> 
> Sorry, I don't know how to use -freal-init=nan.  I tried to use it like this
> but got an error.
> 
> % gfortran FiberAnalysis.f -freal-init=nan -o FiberAnalysis
> 
> gfortran: error: unrecognized command-line option '-freal-init=nan'
> 

Whoops.  It helps if I spell it right.  -finit-real=nan

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

* [Bug fortran/98701] I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10.  I get two very different results for identical input files with the results from the one compiled by gfortran being wrong.
  2021-01-15 20:47 [Bug fortran/98701] New: I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10. I get two very different results for identical input files with the results from the one compiled by gfortran being wrong Bahram.shahrooz at uc dot edu
                   ` (9 preceding siblings ...)
  2021-01-16  6:52 ` sgk at troutmask dot apl.washington.edu
@ 2021-01-16 23:20 ` Bahram.shahrooz at uc dot edu
  2021-01-17  0:08 ` sgk at troutmask dot apl.washington.edu
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Bahram.shahrooz at uc dot edu @ 2021-01-16 23:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98701

--- Comment #11 from Bahram.shahrooz at uc dot edu ---
Thanks!

This is how I compiled: 

gfortran FiberAnalysis.f -finit-real=nan -fcheck=all -ffpe-trap=zero,invalid -o
FiberAnalysis_v2

This what I get after running (the answers are correct):

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic
operation.

Backtrace for this error:
#0  0x105c4ad3d
#1  0x105c4a16d
#2  0x7fff203c4d7c
#3  0x105c34e45
#4  0x105c3c653
#5  0x105c3cae6
zsh: floating point exception  /Users/bahram/FiberAnalysis_v2
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
Deleting expired sessions...none found.

Do you've any suggestions for how to trace the source of error so I can fix the
code?

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

* [Bug fortran/98701] I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10.  I get two very different results for identical input files with the results from the one compiled by gfortran being wrong.
  2021-01-15 20:47 [Bug fortran/98701] New: I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10. I get two very different results for identical input files with the results from the one compiled by gfortran being wrong Bahram.shahrooz at uc dot edu
                   ` (10 preceding siblings ...)
  2021-01-16 23:20 ` Bahram.shahrooz at uc dot edu
@ 2021-01-17  0:08 ` sgk at troutmask dot apl.washington.edu
  2021-01-17  0:09 ` Bahram.shahrooz at uc dot edu
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2021-01-17  0:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98701

--- Comment #12 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Sat, Jan 16, 2021 at 11:20:20PM +0000, Bahram.shahrooz at uc dot edu wrote:
> 
> Do you've any suggestions for how to trace the source
> of error so I can fix the code?
> 

Not really.  I suppose  old fashion debugging is needed
where you put 'print' statements into the code to check
intermediate results. As far as I can tell, you simply
are using undefined variables in the code.  This isn't
a gfortran bug, so the bug report will be closed.

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

* [Bug fortran/98701] I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10.  I get two very different results for identical input files with the results from the one compiled by gfortran being wrong.
  2021-01-15 20:47 [Bug fortran/98701] New: I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10. I get two very different results for identical input files with the results from the one compiled by gfortran being wrong Bahram.shahrooz at uc dot edu
                   ` (11 preceding siblings ...)
  2021-01-17  0:08 ` sgk at troutmask dot apl.washington.edu
@ 2021-01-17  0:09 ` Bahram.shahrooz at uc dot edu
  2021-01-17  8:11 ` kargl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Bahram.shahrooz at uc dot edu @ 2021-01-17  0:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98701

--- Comment #13 from Bahram.shahrooz at uc dot edu ---
Thank you for your help.  I really appreciate your time.

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

* [Bug fortran/98701] I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10.  I get two very different results for identical input files with the results from the one compiled by gfortran being wrong.
  2021-01-15 20:47 [Bug fortran/98701] New: I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10. I get two very different results for identical input files with the results from the one compiled by gfortran being wrong Bahram.shahrooz at uc dot edu
                   ` (12 preceding siblings ...)
  2021-01-17  0:09 ` Bahram.shahrooz at uc dot edu
@ 2021-01-17  8:11 ` kargl at gcc dot gnu.org
  2021-01-17  9:19 ` tkoenig at gcc dot gnu.org
  2021-01-18  0:30 ` Bahram.shahrooz at uc dot edu
  15 siblings, 0 replies; 17+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-01-17  8:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98701

kargl at gcc dot gnu.org changed:

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

--- Comment #14 from kargl at gcc dot gnu.org ---
The code uses undefined variables.  With g77, these seem to be initialized to
some value.  If -freal-init=nan is used, the compiled program dies quickly.  In
other words, the bug is in the program not gfortran.

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

* [Bug fortran/98701] I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10.  I get two very different results for identical input files with the results from the one compiled by gfortran being wrong.
  2021-01-15 20:47 [Bug fortran/98701] New: I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10. I get two very different results for identical input files with the results from the one compiled by gfortran being wrong Bahram.shahrooz at uc dot edu
                   ` (13 preceding siblings ...)
  2021-01-17  8:11 ` kargl at gcc dot gnu.org
@ 2021-01-17  9:19 ` tkoenig at gcc dot gnu.org
  2021-01-18  0:30 ` Bahram.shahrooz at uc dot edu
  15 siblings, 0 replies; 17+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2021-01-17  9:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98701

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

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

--- Comment #15 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Just one final remark.

Using gfortran -O2 -Wall FiberAnalysis.f

will give you

FiberAnalysis.f:146:72:

  146 |       if(eincr.gt.0) xnumber=(esfinal-estart)/eincr
      |                                                                       
^
Warnung: »estart« may be used uninitialized [-Wmaybe-uninitialized]
FiberAnalysis.f:146:44:

  146 |       if(eincr.gt.0) xnumber=(esfinal-estart)/eincr
      |                                            ^
Hinweis: »estart« ist hier deklariert
FiberAnalysis.f:148:9:

  148 |       if(xnumber.gt.500) then
      |         ^
Warnung: »xnumber« könnte in dieser Funktion uninitialisiert verwendet werden
[-Wmaybe-uninitialized]


which pretty well shows where problems could occur.

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

* [Bug fortran/98701] I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10.  I get two very different results for identical input files with the results from the one compiled by gfortran being wrong.
  2021-01-15 20:47 [Bug fortran/98701] New: I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10. I get two very different results for identical input files with the results from the one compiled by gfortran being wrong Bahram.shahrooz at uc dot edu
                   ` (14 preceding siblings ...)
  2021-01-17  9:19 ` tkoenig at gcc dot gnu.org
@ 2021-01-18  0:30 ` Bahram.shahrooz at uc dot edu
  15 siblings, 0 replies; 17+ messages in thread
From: Bahram.shahrooz at uc dot edu @ 2021-01-18  0:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98701

--- Comment #16 from Bahram.shahrooz at uc dot edu ---
I spent a good chunk of today to debug.  The culprit was two variables that had
not been set equal to 0.  I get the same results with g77 on Windows, GFortran
on Mac Big Sur, & AbsoftTools ( I downloaded a trial version to help me debug)
on Mac Big Sur

You guys are so helpful. I truly appreciate your time and.

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

end of thread, other threads:[~2021-01-18  0:30 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-15 20:47 [Bug fortran/98701] New: I compiled a program with gfortran on Mac (Big Sur, version 11.1) and g77 on Windows 10. I get two very different results for identical input files with the results from the one compiled by gfortran being wrong Bahram.shahrooz at uc dot edu
2021-01-15 22:13 ` [Bug fortran/98701] " kargl at gcc dot gnu.org
2021-01-15 23:48 ` jakub at gcc dot gnu.org
2021-01-16  0:30 ` Bahram.shahrooz at uc dot edu
2021-01-16  0:41 ` Bahram.shahrooz at uc dot edu
2021-01-16  0:45 ` sgk at troutmask dot apl.washington.edu
2021-01-16  0:51 ` Bahram.shahrooz at uc dot edu
2021-01-16  1:21 ` sgk at troutmask dot apl.washington.edu
2021-01-16  1:32 ` sgk at troutmask dot apl.washington.edu
2021-01-16  4:48 ` Bahram.shahrooz at uc dot edu
2021-01-16  6:52 ` sgk at troutmask dot apl.washington.edu
2021-01-16 23:20 ` Bahram.shahrooz at uc dot edu
2021-01-17  0:08 ` sgk at troutmask dot apl.washington.edu
2021-01-17  0:09 ` Bahram.shahrooz at uc dot edu
2021-01-17  8:11 ` kargl at gcc dot gnu.org
2021-01-17  9:19 ` tkoenig at gcc dot gnu.org
2021-01-18  0:30 ` Bahram.shahrooz at uc dot edu

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