public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/66765] New: gfortran invoking cc1 on AIX
@ 2015-07-04 16:30 dje at gcc dot gnu.org
  2015-08-30 14:29 ` [Bug fortran/66765] gfortran passing fortran-specific options to ld and collect2 dominiq at lps dot ens.fr
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: dje at gcc dot gnu.org @ 2015-07-04 16:30 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 66765
           Summary: gfortran invoking cc1 on AIX
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dje at gcc dot gnu.org
  Target Milestone: ---
            Target: powerpc-ibm-aix*

/tmp/20150703/gcc/testsuite/gfortran5/../../gfortran
-B/tmp/20150703/gcc/testsuite/gfortran5/../../
-B/tmp/20150703/powerpc-ibm-aix7.1.0.0/./libgfortran/
/nasfarm/edelsohn/src/src/gcc/testsuite/gfortran.dg/implicit_class_1.f90 
-fno-diagnostics-show-caret -fdiagnostics-color=never    -O0 
-fdump-fortran-original 
-B/tmp/20150703/powerpc-ibm-aix7.1.0.0/./libgfortran/.libs
-L/tmp/20150703/powerpc-ibm-aix7.1.0.0/./libgfortran/.libs  -lm    -o
./implicit_class_1.exe

cc1: error: unrecognized command line option '-fdump-fortran-original'
collect2: fatal error: gcc returned 1 exit status
compilation terminated.
compiler exited with status 1

On AIX collect2-ld is a wrapper around the linker.  It finds static
initializers and finalizers, writes them to a file, and compiles them with gcc.
 It passes the command line arguments to gcc.

Compiling and linking a GNU Fortran program with a single command line causes
Fortran options to be passed to cc1 through collect2, causing cc1 to report a
fatal error of an unrecognized command line option.


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

* [Bug fortran/66765] gfortran passing fortran-specific options to ld and collect2
  2015-07-04 16:30 [Bug fortran/66765] New: gfortran invoking cc1 on AIX dje at gcc dot gnu.org
@ 2015-08-30 14:29 ` dominiq at lps dot ens.fr
  2015-08-30 14:40 ` dje at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-08-30 14:29 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2015-08-30
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Compiling and linking a GNU Fortran program with a single command line
> causes Fortran options to be passed to cc1 through collect2, causing cc1
> to report a fatal error of an unrecognized command line option.

I don't understand the problem:

[Book15] f90/bug% gfc iso_c_2.f90 -fdump-fortran-original

Namespace: A-Z: (UNKNOWN 0)
procedure name = MAIN__
  symtree: 'C_funptr'    || symbol: 'c_funptr'     
    type spec : (DERIVED c_funptr)
    attributes: (DERIVED  BIND(C) USE-ASSOC(__iso_c_binding))
    components: (c_address (INTEGER 8) () PRIVATE)
  symtree: 'C_ptr'       || symbol: 'c_ptr'        
...

Am I correct that the problem occurs only when running implicit_class_1.f90
under dejagnu?


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

* [Bug fortran/66765] gfortran passing fortran-specific options to ld and collect2
  2015-07-04 16:30 [Bug fortran/66765] New: gfortran invoking cc1 on AIX dje at gcc dot gnu.org
  2015-08-30 14:29 ` [Bug fortran/66765] gfortran passing fortran-specific options to ld and collect2 dominiq at lps dot ens.fr
@ 2015-08-30 14:40 ` dje at gcc dot gnu.org
  2015-08-30 15:23 ` dominiq at lps dot ens.fr
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dje at gcc dot gnu.org @ 2015-08-30 14:40 UTC (permalink / raw)
  To: gcc-bugs

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

David Edelsohn <dje at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #2 from David Edelsohn <dje at gcc dot gnu.org> ---
This has nothing to do with dejagnu.  On AIX, collect2 re-invokes the compiler
and collect2 uses the compiler command-line arguments.  With or without
dejagnu, the command is invoking a fortran-specific option *and* invoking the
linker wrapped with collect2 to generate an executable.


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

* [Bug fortran/66765] gfortran passing fortran-specific options to ld and collect2
  2015-07-04 16:30 [Bug fortran/66765] New: gfortran invoking cc1 on AIX dje at gcc dot gnu.org
  2015-08-30 14:29 ` [Bug fortran/66765] gfortran passing fortran-specific options to ld and collect2 dominiq at lps dot ens.fr
  2015-08-30 14:40 ` dje at gcc dot gnu.org
@ 2015-08-30 15:23 ` dominiq at lps dot ens.fr
  2015-08-30 17:29 ` dje at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-08-30 15:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> This has nothing to do with dejagnu.  On AIX, collect2 re-invokes the compiler
> and collect2 uses the compiler command-line arguments.  With or without dejagnu,
> the command is invoking a fortran-specific option *and* invoking the linker
> wrapped with collect2 to generate an executable.

Am I correct to understand that this is yet another example of FE options
propagated to places where they do not belong? If yes, this is not a gfortran
bug, but a target one.


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

* [Bug fortran/66765] gfortran passing fortran-specific options to ld and collect2
  2015-07-04 16:30 [Bug fortran/66765] New: gfortran invoking cc1 on AIX dje at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-08-30 15:23 ` dominiq at lps dot ens.fr
@ 2015-08-30 17:29 ` dje at gcc dot gnu.org
  2015-08-30 18:10 ` dominiq at lps dot ens.fr
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dje at gcc dot gnu.org @ 2015-08-30 17:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from David Edelsohn <dje at gcc dot gnu.org> ---
This is not a target-specific bug.  This has nothing to do with the target.

This is a bug where the gfortran front-end and collect2-ld do not work together
correctly.  I don't know how collect2-ld can be expected to know which options
to pass to cc1 and which to strip.  The gfortran front-end should not insert
FE-specific options into the environment utilized by other GCC tools.


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

* [Bug fortran/66765] gfortran passing fortran-specific options to ld and collect2
  2015-07-04 16:30 [Bug fortran/66765] New: gfortran invoking cc1 on AIX dje at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2015-08-30 17:29 ` dje at gcc dot gnu.org
@ 2015-08-30 18:10 ` dominiq at lps dot ens.fr
  2015-08-30 18:12 ` dominiq at lps dot ens.fr
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-08-30 18:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> This is not a target-specific bug.

AFAICT the problem occurs only on AIX.

> The gfortran front-end should not insert FE-specific options into
> the environment utilized by other GCC tools.

If I compile a file with '-fdump-fortran-original -v', I see

COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.10.5' '-fdump-fortran-original'
'-v' '-shared-libgcc' '-mtune=corei7' '-march=corei7'

How do you prevent '-fdump-fortran-original' to appear in COLLECT_GCC_OPTIONS?


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

* [Bug fortran/66765] gfortran passing fortran-specific options to ld and collect2
  2015-07-04 16:30 [Bug fortran/66765] New: gfortran invoking cc1 on AIX dje at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2015-08-30 18:10 ` dominiq at lps dot ens.fr
@ 2015-08-30 18:12 ` dominiq at lps dot ens.fr
  2015-08-30 19:58 ` dje at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-08-30 18:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
BTW what happens on AIX with the other gfortran options such as '-frealloc-lhs'
... ?


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

* [Bug fortran/66765] gfortran passing fortran-specific options to ld and collect2
  2015-07-04 16:30 [Bug fortran/66765] New: gfortran invoking cc1 on AIX dje at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2015-08-30 18:12 ` dominiq at lps dot ens.fr
@ 2015-08-30 19:58 ` dje at gcc dot gnu.org
  2015-08-30 21:25 ` dominiq at lps dot ens.fr
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dje at gcc dot gnu.org @ 2015-08-30 19:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from David Edelsohn <dje at gcc dot gnu.org> ---
AIX often exposes symptoms of bugs in common parts of the compiler.  That does
not make the problem an AIX or target bug.

If the Fortran FE generates incorrect IR that causes an ICE in the middle end
of the compiler, the bug is not in the middle end of the compiler.

Any of the Fortran FE options appearing in a link command likely cause an
error.


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

* [Bug fortran/66765] gfortran passing fortran-specific options to ld and collect2
  2015-07-04 16:30 [Bug fortran/66765] New: gfortran invoking cc1 on AIX dje at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2015-08-30 19:58 ` dje at gcc dot gnu.org
@ 2015-08-30 21:25 ` dominiq at lps dot ens.fr
  2015-08-31  0:05 ` dje at gcc dot gnu.org
  2021-12-18  2:49 ` [Bug driver/66765] " pinskia at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-08-30 21:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Any of the Fortran FE options appearing in a link command likely cause an error.

Apparently it more complicated than that:

[Book15] f90/bug% gcc ya_sincos.c -fdump-fortran-original
cc1: error: unrecognized command line option '-fdump-fortran-original'

but

[Book15] f90/bug% gcc ya_sincos.c -fblah-blah
gcc: error: unrecognized command line option '-fblah-blah'

nothing to do with gfortran FE, and

[Book15] f90/bug% gcc ya_sincos.c -fdefault-integer-8
cc1: warning: command line option '-fdefault-integer-8' is valid for Fortran
but not for C


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

* [Bug fortran/66765] gfortran passing fortran-specific options to ld and collect2
  2015-07-04 16:30 [Bug fortran/66765] New: gfortran invoking cc1 on AIX dje at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2015-08-30 21:25 ` dominiq at lps dot ens.fr
@ 2015-08-31  0:05 ` dje at gcc dot gnu.org
  2021-12-18  2:49 ` [Bug driver/66765] " pinskia at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: dje at gcc dot gnu.org @ 2015-08-31  0:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from David Edelsohn <dje at gcc dot gnu.org> ---
> [Book15] f90/bug% gcc ya_sincos.c -fdump-fortran-original
> cc1: error: unrecognized command line option '-fdump-fortran-original'

This is a valid Fortran option producing an error from cc1 when passed to gcc.

but

> [Book15] f90/bug% gcc ya_sincos.c -fblah-blah
> gcc: error: unrecognized command line option '-fblah-blah'

This is an invalid command line option for any GCC front-end and evokes an
error from gcc.  I'm not sure what you are trying to prove.

> nothing to do with gfortran FE, and

> [Book15] f90/bug% gcc ya_sincos.c -fdefault-integer-8
> cc1: warning: command line option '-fdefault-integer-8' is valid for Fortran but not for C

Some errors are caught with a more user-friendly error message.  I don't see
what any of this proves.

The Fortran FE is the only place that can differentiate between gfortran
command line options and c-family command line options.


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

* [Bug driver/66765] gfortran passing fortran-specific options to ld and collect2
  2015-07-04 16:30 [Bug fortran/66765] New: gfortran invoking cc1 on AIX dje at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2015-08-31  0:05 ` dje at gcc dot gnu.org
@ 2021-12-18  2:49 ` pinskia at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-18  2:49 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
          Component|fortran                     |driver

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is definitely a driver issue. I don't know if we have fixed this one yet
or not.  I suspect it is still there. I think the driver should get rid of the
non-C front-end acceptable options when passing them down to collect2.

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

end of thread, other threads:[~2021-12-18  2:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-04 16:30 [Bug fortran/66765] New: gfortran invoking cc1 on AIX dje at gcc dot gnu.org
2015-08-30 14:29 ` [Bug fortran/66765] gfortran passing fortran-specific options to ld and collect2 dominiq at lps dot ens.fr
2015-08-30 14:40 ` dje at gcc dot gnu.org
2015-08-30 15:23 ` dominiq at lps dot ens.fr
2015-08-30 17:29 ` dje at gcc dot gnu.org
2015-08-30 18:10 ` dominiq at lps dot ens.fr
2015-08-30 18:12 ` dominiq at lps dot ens.fr
2015-08-30 19:58 ` dje at gcc dot gnu.org
2015-08-30 21:25 ` dominiq at lps dot ens.fr
2015-08-31  0:05 ` dje at gcc dot gnu.org
2021-12-18  2:49 ` [Bug driver/66765] " pinskia 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).