public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/97799] New: Passing CHARACTER*(*) var(*) through ENTRY causes segfaults
@ 2020-11-11 16:33 hockney at jpl dot nasa.gov
  2020-11-11 16:36 ` [Bug fortran/97799] " hockney at jpl dot nasa.gov
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: hockney at jpl dot nasa.gov @ 2020-11-11 16:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97799
           Summary: Passing CHARACTER*(*) var(*) through ENTRY causes
                    segfaults
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hockney at jpl dot nasa.gov
  Target Milestone: ---

Created attachment 49548
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49548&action=edit
bugtest.f -- program evincing bug

When a character(*)* var(*) is passed to a subroutine
through an entry point in another subroutine, gfortran 10.2.0
generates an exectuable which segfaults in a probablistic way.  This
is probably related to a warning about an internally
generated variable being used uninitialized.  The warning and error
do not occur in gfortran 9.2.0

   The attached file bugtest.f evinces this behavior.  The
attached file details.txt shows the exact compilition
flags to reproduce the failure, and also the resulting
backtrace.

  The exact combination of compilation flags matters.  All of
them produce the warning about carray.0 but some of them
both work and pass our valgrind test:

gfortran -Wall -g -S bugtest.f; gfortran bugtest.s -o bugtest  #  fail
gfortran -g bugtest.f -o bugtest  #  fail
gfortran -O1 bugtest.f -o bugtest  #  fail
gfortran -O2 bugtest.f -o bugtest  #  ok
gfortran -O3 bugtest.f -o bugtest  #  ok
gfortran -O2 -fPIC bugtest.f -o bugtest  #  fail
gfortran -O3 -fPIC bugtest.f -o bugtest  #  fail


The valgrind error trace for the errors is:
==32181== Conditional jump or move depends on uninitialised value(s)
==32181==    at 0x401438: master.0.top_entry_ (bugtest.f:53)
==32181==    by 0x40141B: char_entry_ (bugtest.f:49)
==32181==    by 0x40148F: MAIN__ (bugtest.f:6)
==32181==    by 0x401698: main (bugtest.f:12)


  gfortran 9.2.0 does not evince this bug.

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

* [Bug fortran/97799] Passing CHARACTER*(*) var(*) through ENTRY causes segfaults
  2020-11-11 16:33 [Bug fortran/97799] New: Passing CHARACTER*(*) var(*) through ENTRY causes segfaults hockney at jpl dot nasa.gov
@ 2020-11-11 16:36 ` hockney at jpl dot nasa.gov
  2020-11-11 16:37 ` hockney at jpl dot nasa.gov
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: hockney at jpl dot nasa.gov @ 2020-11-11 16:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from George Hockney <hockney at jpl dot nasa.gov> ---
Created attachment 49549
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49549&action=edit
details.txt -- detailed invocation and outputs

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

* [Bug fortran/97799] Passing CHARACTER*(*) var(*) through ENTRY causes segfaults
  2020-11-11 16:33 [Bug fortran/97799] New: Passing CHARACTER*(*) var(*) through ENTRY causes segfaults hockney at jpl dot nasa.gov
  2020-11-11 16:36 ` [Bug fortran/97799] " hockney at jpl dot nasa.gov
@ 2020-11-11 16:37 ` hockney at jpl dot nasa.gov
  2020-11-11 16:59 ` dominiq at lps dot ens.fr
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: hockney at jpl dot nasa.gov @ 2020-11-11 16:37 UTC (permalink / raw)
  To: gcc-bugs

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

George Hockney <hockney at jpl dot nasa.gov> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |9.2.0
      Known to fail|                            |10.2.0

--- Comment #2 from George Hockney <hockney at jpl dot nasa.gov> ---
Added details.txt attachment and updated Known to work and Known to fail fields

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

* [Bug fortran/97799] Passing CHARACTER*(*) var(*) through ENTRY causes segfaults
  2020-11-11 16:33 [Bug fortran/97799] New: Passing CHARACTER*(*) var(*) through ENTRY causes segfaults hockney at jpl dot nasa.gov
  2020-11-11 16:36 ` [Bug fortran/97799] " hockney at jpl dot nasa.gov
  2020-11-11 16:37 ` hockney at jpl dot nasa.gov
@ 2020-11-11 16:59 ` dominiq at lps dot ens.fr
  2020-11-11 17:51 ` ted.drain at jpl dot nasa.gov
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-11-11 16:59 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-11-11
           Priority|P3                          |P4

--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
I confirm the problem for GCC 10.2, but it seems fixed for 10.2.1 20201017, and
11.

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

* [Bug fortran/97799] Passing CHARACTER*(*) var(*) through ENTRY causes segfaults
  2020-11-11 16:33 [Bug fortran/97799] New: Passing CHARACTER*(*) var(*) through ENTRY causes segfaults hockney at jpl dot nasa.gov
                   ` (2 preceding siblings ...)
  2020-11-11 16:59 ` dominiq at lps dot ens.fr
@ 2020-11-11 17:51 ` ted.drain at jpl dot nasa.gov
  2020-11-11 18:57 ` dominiq at lps dot ens.fr
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ted.drain at jpl dot nasa.gov @ 2020-11-11 17:51 UTC (permalink / raw)
  To: gcc-bugs

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

Ted Drain <ted.drain at jpl dot nasa.gov> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ted.drain at jpl dot nasa.gov

--- Comment #4 from Ted Drain <ted.drain at jpl dot nasa.gov> ---
Dominique,
Did you happen to run valgrind using the 10.2.1 build?  This error doesn't
always cause a core dump - sometimes it appears to work.  Valgrind reports the
error even if the program seems to run.

Thanks,
Ted

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

* [Bug fortran/97799] Passing CHARACTER*(*) var(*) through ENTRY causes segfaults
  2020-11-11 16:33 [Bug fortran/97799] New: Passing CHARACTER*(*) var(*) through ENTRY causes segfaults hockney at jpl dot nasa.gov
                   ` (3 preceding siblings ...)
  2020-11-11 17:51 ` ted.drain at jpl dot nasa.gov
@ 2020-11-11 18:57 ` dominiq at lps dot ens.fr
  2020-11-11 20:23 ` anlauf at gcc dot gnu.org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-11-11 18:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Did you happen to run valgrind using the 10.2.1 build?

Unfortunately I don't have valgrind on my new laptop (OSX Catalina).
However I have run the test 20 times with 10.2.1 without any failure, while I
got 10 failures out of 10 runs on 10.2.0.

Also I get the warning with 10.2 but not with any other release I have tried
(including an instrumented compiler).

I have tried another laptop with valgrind and did not see any problem, but I
don't have 10.2.0 on it.

So it seems you stumbled on a 10 regression that have been fixed.

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

* [Bug fortran/97799] Passing CHARACTER*(*) var(*) through ENTRY causes segfaults
  2020-11-11 16:33 [Bug fortran/97799] New: Passing CHARACTER*(*) var(*) through ENTRY causes segfaults hockney at jpl dot nasa.gov
                   ` (4 preceding siblings ...)
  2020-11-11 18:57 ` dominiq at lps dot ens.fr
@ 2020-11-11 20:23 ` anlauf at gcc dot gnu.org
  2020-11-11 21:11 ` hockney at jpl dot nasa.gov
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-11-11 20:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from anlauf at gcc dot gnu.org ---
I couldn't find any current 11-master, 10-, 9- and 8-branch version that
fails on x86_64-pc-linux-gnu, under valgrind, and with -m32 and -m64.

So it looks very likely that Dominique is right that this has been fixed
everywhere.  Otherwise please provide more details on your environment.

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

* [Bug fortran/97799] Passing CHARACTER*(*) var(*) through ENTRY causes segfaults
  2020-11-11 16:33 [Bug fortran/97799] New: Passing CHARACTER*(*) var(*) through ENTRY causes segfaults hockney at jpl dot nasa.gov
                   ` (5 preceding siblings ...)
  2020-11-11 20:23 ` anlauf at gcc dot gnu.org
@ 2020-11-11 21:11 ` hockney at jpl dot nasa.gov
  2020-11-12  6:26 ` tkoenig at gcc dot gnu.org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: hockney at jpl dot nasa.gov @ 2020-11-11 21:11 UTC (permalink / raw)
  To: gcc-bugs

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

George Hockney <hockney at jpl dot nasa.gov> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |10.2.1

--- Comment #7 from George Hockney <hockney at jpl dot nasa.gov> ---
We have build 10.2.1 20201017 locally and bugtest.f passes.

No warning messages
valgrind says it's OK
runs OK.


We are in process of a major build testing a large-scale legacy software
package, but it looks as if this regression is fixed.

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

* [Bug fortran/97799] Passing CHARACTER*(*) var(*) through ENTRY causes segfaults
  2020-11-11 16:33 [Bug fortran/97799] New: Passing CHARACTER*(*) var(*) through ENTRY causes segfaults hockney at jpl dot nasa.gov
                   ` (6 preceding siblings ...)
  2020-11-11 21:11 ` hockney at jpl dot nasa.gov
@ 2020-11-12  6:26 ` tkoenig at gcc dot gnu.org
  2020-11-12  7:53 ` tkoenig at gcc dot gnu.org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-11-12  6:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #8 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Comment on attachment 49548
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49548
bugtest.f -- program evincing bug

So, commit the test case to guard against regressions
(since it is not immediately obvious if this is already
covered).

I'll do so in a short while.

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

* [Bug fortran/97799] Passing CHARACTER*(*) var(*) through ENTRY causes segfaults
  2020-11-11 16:33 [Bug fortran/97799] New: Passing CHARACTER*(*) var(*) through ENTRY causes segfaults hockney at jpl dot nasa.gov
                   ` (7 preceding siblings ...)
  2020-11-12  6:26 ` tkoenig at gcc dot gnu.org
@ 2020-11-12  7:53 ` tkoenig at gcc dot gnu.org
  2020-11-12 13:27 ` tkoenig at gcc dot gnu.org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-11-12  7:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to Thomas Koenig from comment #8)
> Comment on attachment 49548 [details]
> bugtest.f -- program evincing bug
> 
> So, commit the test case to guard against regressions
> (since it is not immediately obvious if this is already
> covered).
> 
> I'll do so in a short while.

Or as soon as bootstrap works again.

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

* [Bug fortran/97799] Passing CHARACTER*(*) var(*) through ENTRY causes segfaults
  2020-11-11 16:33 [Bug fortran/97799] New: Passing CHARACTER*(*) var(*) through ENTRY causes segfaults hockney at jpl dot nasa.gov
                   ` (8 preceding siblings ...)
  2020-11-12  7:53 ` tkoenig at gcc dot gnu.org
@ 2020-11-12 13:27 ` tkoenig at gcc dot gnu.org
  2020-11-12 15:29 ` hockney at jpl dot nasa.gov
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-11-12 13:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #10 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Test case committed to master as
https://gcc.gnu.org/g:3c3beb1a8137460bc485f9fbe3be8b21ee7f91a2 and
to gcc 10 as https://gcc.gnu.org/g:910250c360291074d0908feb111403e6bb3b32ee .

Thanks for the report!

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

* [Bug fortran/97799] Passing CHARACTER*(*) var(*) through ENTRY causes segfaults
  2020-11-11 16:33 [Bug fortran/97799] New: Passing CHARACTER*(*) var(*) through ENTRY causes segfaults hockney at jpl dot nasa.gov
                   ` (9 preceding siblings ...)
  2020-11-12 13:27 ` tkoenig at gcc dot gnu.org
@ 2020-11-12 15:29 ` hockney at jpl dot nasa.gov
  2020-11-13 10:32 ` [Bug fortran/97799] [10/11 Regression] " tkoenig at gcc dot gnu.org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: hockney at jpl dot nasa.gov @ 2020-11-12 15:29 UTC (permalink / raw)
  To: gcc-bugs

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

George Hockney <hockney at jpl dot nasa.gov> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |VERIFIED

--- Comment #11 from George Hockney <hockney at jpl dot nasa.gov> ---
We've verified a large-scale legacy build against 

GNU Fortran (gcc8.2) 11.0.0 20201111 (experimental)

and

GNU Fortran (GCC) 10.2.1 20201017

All our regressions pass these compilers.

Therefore, I'm changing the status to verified (this is per our bugzilla
workflow; if it's not your workflow please fix)



Unfortunately, 10.2.0 was released with this bug.

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

* [Bug fortran/97799] [10/11 Regression] Passing CHARACTER*(*) var(*) through ENTRY causes segfaults
  2020-11-11 16:33 [Bug fortran/97799] New: Passing CHARACTER*(*) var(*) through ENTRY causes segfaults hockney at jpl dot nasa.gov
                   ` (10 preceding siblings ...)
  2020-11-12 15:29 ` hockney at jpl dot nasa.gov
@ 2020-11-13 10:32 ` tkoenig at gcc dot gnu.org
  2020-11-13 11:09 ` jakub at gcc dot gnu.org
  2020-11-13 11:11 ` jakub at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-11-13 10:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.3
            Summary|Passing CHARACTER*(*)       |[10/11 Regression] Passing
                   |var(*) through ENTRY causes |CHARACTER*(*) var(*)
                   |segfaults                   |through ENTRY causes
                   |                            |segfaults
             Status|VERIFIED                    |RESOLVED

--- Comment #12 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to George Hockney from comment #11)
> We've verified a large-scale legacy build against 
> 
> GNU Fortran (gcc8.2) 11.0.0 20201111 (experimental)
> 
> and
> 
> GNU Fortran (GCC) 10.2.1 20201017
> 
> All our regressions pass these compilers.

Thanks for letting us know.

> Therefore, I'm changing the status to verified (this is per our bugzilla
> workflow; if it's not your workflow please fix)

It's not usually done, so I'll just change this back (there are
a few search masks which don't have VERIFIED in).

> Unfortunately, 10.2.0 was released with this bug.

Yep.

I have looked over the changes to gcc10 since the 10.2 release to the gfortran
front end  haven't found anything obvious that could have fixed this;
I don't think we need to do a bisection, having the test case should
be enough.

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

* [Bug fortran/97799] [10/11 Regression] Passing CHARACTER*(*) var(*) through ENTRY causes segfaults
  2020-11-11 16:33 [Bug fortran/97799] New: Passing CHARACTER*(*) var(*) through ENTRY causes segfaults hockney at jpl dot nasa.gov
                   ` (11 preceding siblings ...)
  2020-11-13 10:32 ` [Bug fortran/97799] [10/11 Regression] " tkoenig at gcc dot gnu.org
@ 2020-11-13 11:09 ` jakub at gcc dot gnu.org
  2020-11-13 11:11 ` jakub at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-11-13 11:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Trunk bisection shows this started with
r11-271-g892c7427ee234c04852e90d9ce32913a429adf9d
and went away with r11-2923-gcb3c3d63315ceb4dc262e5efb83b42c73c43387d

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

* [Bug fortran/97799] [10/11 Regression] Passing CHARACTER*(*) var(*) through ENTRY causes segfaults
  2020-11-11 16:33 [Bug fortran/97799] New: Passing CHARACTER*(*) var(*) through ENTRY causes segfaults hockney at jpl dot nasa.gov
                   ` (12 preceding siblings ...)
  2020-11-13 11:09 ` jakub at gcc dot gnu.org
@ 2020-11-13 11:11 ` jakub at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-11-13 11:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So dup of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672#c12 ?

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

end of thread, other threads:[~2020-11-13 11:11 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-11 16:33 [Bug fortran/97799] New: Passing CHARACTER*(*) var(*) through ENTRY causes segfaults hockney at jpl dot nasa.gov
2020-11-11 16:36 ` [Bug fortran/97799] " hockney at jpl dot nasa.gov
2020-11-11 16:37 ` hockney at jpl dot nasa.gov
2020-11-11 16:59 ` dominiq at lps dot ens.fr
2020-11-11 17:51 ` ted.drain at jpl dot nasa.gov
2020-11-11 18:57 ` dominiq at lps dot ens.fr
2020-11-11 20:23 ` anlauf at gcc dot gnu.org
2020-11-11 21:11 ` hockney at jpl dot nasa.gov
2020-11-12  6:26 ` tkoenig at gcc dot gnu.org
2020-11-12  7:53 ` tkoenig at gcc dot gnu.org
2020-11-12 13:27 ` tkoenig at gcc dot gnu.org
2020-11-12 15:29 ` hockney at jpl dot nasa.gov
2020-11-13 10:32 ` [Bug fortran/97799] [10/11 Regression] " tkoenig at gcc dot gnu.org
2020-11-13 11:09 ` jakub at gcc dot gnu.org
2020-11-13 11:11 ` jakub 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).