public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/64517] New: Inconsistent behavior when mixing -E and -M
@ 2015-01-07 3:25 thfanning at gmail dot com
2015-01-07 3:29 ` [Bug fortran/64517] " thfanning at gmail dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: thfanning at gmail dot com @ 2015-01-07 3:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64517
Bug ID: 64517
Summary: Inconsistent behavior when mixing -E and -M
Product: gcc
Version: 4.9.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: thfanning at gmail dot com
According to documentation, "Passing -M to the driver implies -E". However an
explicit `-E` produces different behavior.
touch test.F90
gfortran -M test.F90
produces:
test.o: test.F90
However,
gfortran -E -M test.F90
produces
# 1 "test.F90"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "test.F90"
test.o: test.F90
As a result, preprocessor output is mixed with dependency output. A kludge is
to add `-o /dev/null`, but that is ugly.
The description for `-E` states: "The output is in the form of preprocessed
source code, which is sent to the standard output." But shouldn't `-M` change
*what* is sent to stdout?
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/64517] Inconsistent behavior when mixing -E and -M
2015-01-07 3:25 [Bug fortran/64517] New: Inconsistent behavior when mixing -E and -M thfanning at gmail dot com
@ 2015-01-07 3:29 ` thfanning at gmail dot com
2015-01-09 11:03 ` [Bug preprocessor/64517] " dominiq at lps dot ens.fr
2015-01-10 6:34 ` thfanning at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: thfanning at gmail dot com @ 2015-01-07 3:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64517
--- Comment #1 from Thomas Fanning <thfanning at gmail dot com> ---
There is a bigger problem that I didn't immediately recognize with the empty
file: Using `-M` results in gfortran trying to compile the source. I.e., it
does *not* stop after preprocessing, which it should if `-E` is implied.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug preprocessor/64517] Inconsistent behavior when mixing -E and -M
2015-01-07 3:25 [Bug fortran/64517] New: Inconsistent behavior when mixing -E and -M thfanning at gmail dot com
2015-01-07 3:29 ` [Bug fortran/64517] " thfanning at gmail dot com
@ 2015-01-09 11:03 ` dominiq at lps dot ens.fr
2015-01-10 6:34 ` thfanning at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-01-09 11:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64517
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2015-01-09
Component|fortran |preprocessor
Ever confirmed|0 |1
--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Fist the -E and -M options are not gfortran specific (see
https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html#Preprocessor-Options).
For the following C code
cat vbmi.c
typedef char __v64qi __attribute__ ((__vector_size__ (64)));
__v64qi
_mm512_multishift_epi64_epi8 (__v64qi __X, __v64qi __Y)
{
return (__v64qi) __builtin_ia32_vpmultishiftqb512_mask ((__v64qi)
__X,
(__v64qi) __Y,
(__v64qi) __Y,
-1);
}
gcc vbmi.c -M
gives
vbmi.o: vbmi.c
gcc vbmi.c -E
gives
# 1 "vbmi.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "vbmi.c"
typedef char __v64qi __attribute__ ((__vector_size__ (64)));
__v64qi
_mm512_multishift_epi64_epi8 (__v64qi __X, __v64qi __Y)
{
return (__v64qi) __builtin_ia32_vpmultishiftqb512_mask ((__v64qi)
__X,
(__v64qi) __Y,
(__v64qi) __Y,
-1);
}
and
gcc vbmi.c -E -M
gives
vbmi.o: vbmi.c
So it seems that the sentence
Passing -M to the driver implies -E, ...
is not accurate. Thus I am moving the PR to the 'preprocessor' component.
> There is a bigger problem that I didn't immediately recognize with
> the empty file: Using `-M` results in gfortran trying to compile
> the source. I.e., it does *not* stop after preprocessing, which
> it should if `-E` is implied.
I don't see that (at least using -E on a code generating *.mod files when
compiled does not generate these files).
Note that the use of preprocessor with fortran leads to several PRs: see
pr47485, pr47486, pr47720, and pr49149.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug preprocessor/64517] Inconsistent behavior when mixing -E and -M
2015-01-07 3:25 [Bug fortran/64517] New: Inconsistent behavior when mixing -E and -M thfanning at gmail dot com
2015-01-07 3:29 ` [Bug fortran/64517] " thfanning at gmail dot com
2015-01-09 11:03 ` [Bug preprocessor/64517] " dominiq at lps dot ens.fr
@ 2015-01-10 6:34 ` thfanning at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: thfanning at gmail dot com @ 2015-01-10 6:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64517
--- Comment #3 from Thomas Fanning <thfanning at gmail dot com> ---
In gcc-4.9.2, using both -M and -E produce the expected output: dependencies
only. But in gfortran, both preprocessed output and dependencies are produced.
This is incorrect.
It seems to me that the gfortran driver is not setting up the preprocessing
environment correctly, so I'm not sure this is strictly a preprocessor problem.
For the following C code: preprocess.c
// It's me!
#include "UTIL_System.h"
int main()
{
return 0;
}
gcc -M preprocess.c
--> preprocess.o: preprocess.c UTIL_System.h <-- dependencies
gcc -M -E preprocess.c
--> preprocess.o: preprocess.c UTIL_System.h <-- dependencies
Since GNU make defines CPP = '$(CC) -E', it is essential that combining -E and
-M are compatible.
For the following gfortran file however: preprocess.F90
! It's me!
program test
#include "UTIL_System.h"
print *, "Hello, World!"
end program
gfortran -M preprocess.F90
--> preprocess.o: preprocess.F90 UTIL_System.h <-- dependencies
But gfortran -M -E preprocess.F90
--> # 1 "preprocess.F90"
--> # 1 "<built-in>"
--> # 1 "<command-line>"
--> # 1 "preprocess.F90"
--> ! It's me!
--> program test
-->
--> # 1 "UTIL_System.h" 1
--> # 4 "preprocess.F90" 2
--> print *, "Hello, World!"
--> end program
--> preprocess.o: preprocess.F90 UTIL_System.h <-- dependencies
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-01-10 6:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-07 3:25 [Bug fortran/64517] New: Inconsistent behavior when mixing -E and -M thfanning at gmail dot com
2015-01-07 3:29 ` [Bug fortran/64517] " thfanning at gmail dot com
2015-01-09 11:03 ` [Bug preprocessor/64517] " dominiq at lps dot ens.fr
2015-01-10 6:34 ` thfanning at gmail 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).