[Bug fortran/67250] gfortran does not faithfully preprocess the way cpp does

2015-08-19 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67250

--- Comment #14 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
(In reply to Jeff Hammond from comment #13)
 This is all fair.  I try very hard to fix my own bugs and submit patches,
 but in this case I am wholly unqualified.  I don't know the first thing
 about implementing a production compiler, or any compiler for that matter.

To work on GCC, you mostly need to know C/C++, how to use GDB and be able to
setup the bootstrap and regression test environment. Most tasks are not hard or
require any special knowledge, just tedious (run the testsuite, follow-up on
patches, trace code through the debugger and figure out why it is not working
as it should). In fact, GCC is not lacking patches, there are many unapplied
patches in bugzilla and the mailing lists. It lacks people motivated enough to
do all the red-tape work necessary to get a patch applied to the repository.

[Bug fortran/67250] gfortran does not faithfully preprocess the way cpp does

2015-08-18 Thread jeff.science at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67250

--- Comment #9 from Jeff Hammond jeff.science at gmail dot com ---
First, you will not accept the fusion of cpp+gfortran behavior as a feature
request?  Is there a reason other than you do not want to do it because you are
already busy?

Second, true, but that doesn't stop gcc from supporting inline assembly outside
of ISO C11, or stop gfortran from being compatible with vendor implementations
of https://gcc.gnu.org/onlinedocs/gfortran/Cray-pointers.html, or of supporting
any number of other non-standard features.

In short, it's not in the standard, therefore it's fine to break user
experience seems pretty weak here.  It's fine if you tell me that you do not
care about my needs and will not implement it, but please don't use ISO as the
excuse.


[Bug fortran/67250] gfortran does not faithfully preprocess the way cpp does

2015-08-18 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67250

Manuel López-Ibáñez manu at gcc dot gnu.org changed:

   What|Removed |Added

 CC||manu at gcc dot gnu.org
 Resolution|WONTFIX |DUPLICATE

--- Comment #12 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
Hi Jeff,

I think Steve and Andrew are just explaining why it works this way and why it
is not possible to change the default behavior. Calling this a bug is not
fair, because it works as intended and documented.

Of course, it may be possible to implement a different behavior under a new
command-line option, but that would require someone to do all the work required
to get this implemented. In fact, there has been such work going on but
progress has been slow (see PR28662). You could offer your help to Tobias
(https://gcc.gnu.org/wiki/GettingStarted#Basics:_Contributing_to_GCC_in_10_easy_steps).
People who are already happy with the current behavior are not likely to do it
for you.

*** This bug has been marked as a duplicate of bug 28662 ***

[Bug fortran/67250] gfortran does not faithfully preprocess the way cpp does

2015-08-18 Thread sgk at troutmask dot apl.washington.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67250

--- Comment #11 from Steve Kargl sgk at troutmask dot apl.washington.edu ---
On Tue, Aug 18, 2015 at 06:03:00AM +, jeff.science at gmail dot com wrote:
 
 In short, it's not in the standard, therefore it's fine to break user
 experience seems pretty weak here.  It's fine if you tell me that you do not
 care about my needs and will not implement it, but please don't use ISO as the
 excuse.
 

Well, no.  It's not standard, so a compiler implementation
is free define its own behavior.  The gfortran manual
has documented its behavior for a very long time.  Have
you read the gfortran manual?


[Bug fortran/67250] gfortran does not faithfully preprocess the way cpp does

2015-08-18 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67250

--- Comment #10 from Andrew Pinski pinskia at gcc dot gnu.org ---
(In reply to Jeff Hammond from comment #9)
 First, you will not accept the fusion of cpp+gfortran behavior as a feature
 request?  Is there a reason other than you do not want to do it because you
 are already busy?

Because you are mixing two different things together.  Patches are welcome
really.

 
 Second, true, but that doesn't stop gcc from supporting inline assembly
 outside of ISO C11, or stop gfortran from being compatible with vendor
 implementations of
 https://gcc.gnu.org/onlinedocs/gfortran/Cray-pointers.html, or of supporting
 any number of other non-standard features.
 
 In short, it's not in the standard, therefore it's fine to break user
 experience seems pretty weak here.  It's fine if you tell me that you do
 not care about my needs and will not implement it, but please don't use ISO
 as the excuse.

No that is not what I am saying.  What I am saying is since it is non-standard
different compilers will decide to support it differently.  In this case
gfortran is following what was done for g77.  So changing it will break user
experience for folks who have used g77.


[Bug fortran/67250] gfortran does not faithfully preprocess the way cpp does

2015-08-18 Thread jeff.science at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67250

--- Comment #13 from Jeff Hammond jeff.science at gmail dot com ---
This is all fair.  I try very hard to fix my own bugs and submit patches, but
in this case I am wholly unqualified.  I don't know the first thing about
implementing a production compiler, or any compiler for that matter.

I believe that some of my Intel colleagues contribute to GCC already.  If I can
figure out who they are, perhaps I can convince them to help here, since
replicating the behavior of the Intel Fortran compiler has value for us.

And yes, I did read a fraction of the gfortran manual (which google decided was
relevant to my issue) in hopes of trying to solve this on my own.  I confess to
not having read the entire gfortran manual.


[Bug fortran/67250] gfortran does not faithfully preprocess the way cpp does

2015-08-17 Thread jeff.science at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67250

Jeff Hammond jeff.science at gmail dot com changed:

   What|Removed |Added

 Status|RESOLVED|UNCONFIRMED
 Resolution|INVALID |---

--- Comment #6 from Jeff Hammond jeff.science at gmail dot com ---
I want gfortran to behave like cpp, not the other way around.  I filed this bug
report against gfortran, not cpp, and I noted my desire to have gfortran behave
like cpp in both the title and original comments.

Please do not close the bug until you have addressed the bug report, and not a
closely related but ultimately opposite issue.


[Bug fortran/67250] gfortran does not faithfully preprocess the way cpp does

2015-08-17 Thread jeff.science at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67250

--- Comment #7 from Jeff Hammond jeff.science at gmail dot com ---
And your obvious workaround is in fact not one because it changes the
behavior of gfortran for Fortran source code and breaks the build in another
way.  And even if it did solve the problem, why not make it automatic with a
flag to gfortran?  

The Intel Fortran compiler behaves as desired by default.


[Bug fortran/67250] gfortran does not faithfully preprocess the way cpp does

2015-08-17 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67250

Andrew Pinski pinskia at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |WONTFIX

--- Comment #8 from Andrew Pinski pinskia at gcc dot gnu.org ---
(In reply to Jeff Hammond from comment #7)
 And your obvious workaround is in fact not one because it changes the
 behavior of gfortran for Fortran source code and breaks the build in another
 way.  And even if it did solve the problem, why not make it automatic with a
 flag to gfortran?  
 

The only way is to use the workaround sorry.  You could try -no-traditional-cpp
.  But as you said it will break the build in a different way and that is
because the fortran code is not C code.  

 The Intel Fortran compiler behaves as desired by default.

So.  Using the C preprocessor is out side of the scope of the fortran standard
so different compilers will act differently.


[Bug fortran/67250] gfortran does not faithfully preprocess the way cpp does

2015-08-17 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67250

--- Comment #1 from Andrew Pinski pinskia at gcc dot gnu.org ---
See the option -traditional-cpp.


[Bug fortran/67250] gfortran does not faithfully preprocess the way cpp does

2015-08-17 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67250

--- Comment #2 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
*** Bug 67251 has been marked as a duplicate of this bug. ***

[Bug fortran/67250] gfortran does not faithfully preprocess the way cpp does

2015-08-17 Thread jeff.science at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67250

--- Comment #3 from Jeff Hammond jeff.science at gmail dot com ---
Unfortunately, this does not change anything.

 gfortran-5 -traditional-cpp -I. -E source.F 
# 1 source.F
# 1 built-in
# 1 command-line
# 1 source.F
C
C OLD SCHOOL COMMENTS
C
  subroutine xyz(stuff)
  implicit none

# 1 header.fh 1
! comment
  integer foo
  external foo
# 7 source.F 2
  integer stuff
  integer err_##handle;   integer l_##handle,k_##handle;
  err_##handle=foo(100,#handle,l_##handle,k_##handle);   if
(.not.err_##handle) call bar(PUSH#handle,#100);
  print*,stuff
  return
  end


[Bug fortran/67250] gfortran does not faithfully preprocess the way cpp does

2015-08-17 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67250

--- Comment #4 from Andrew Pinski pinskia at gcc dot gnu.org ---
(In reply to Jeff Hammond from comment #3)
 Unfortunately, this does not change anything.
 

I saying gfortran defaults to that and you can use that option to cpp to get
the same behavior. 





  gfortran-5 -traditional-cpp -I. -E source.F 
 # 1 source.F
 # 1 built-in
 # 1 command-line
 # 1 source.F
 C
 C OLD SCHOOL COMMENTS
 C
   subroutine xyz(stuff)
   implicit none
 
 # 1 header.fh 1
 ! comment
   integer foo
   external foo
 # 7 source.F 2
   integer stuff
   integer err_##handle;   integer l_##handle,k_##handle;
   err_##handle=foo(100,#handle,l_##handle,k_##handle);   if
 (.not.err_##handle) call bar(PUSH#handle,#100);
   print*,stuff
   return
   end


[Bug fortran/67250] gfortran does not faithfully preprocess the way cpp does

2015-08-17 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67250

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||kargl at gcc dot gnu.org
 Resolution|--- |INVALID
   Severity|blocker |normal

--- Comment #5 from kargl at gcc dot gnu.org ---
See the documenation where it explicitly states:

   Many Fortran compilers including GNU Fortran allow passing
   the source code through a C preprocessor (CPP; sometimes
   also called the Fortran preprocessor, FPP) to allow for
   conditional compilation.  In the case of GNU Fortran, this
   is the GNU C Preprocessor in the traditional mode.

% ~/work/5/bin/cpp -I. -E -traditional-cpp u2.F

gives the same result as gfortran -I. -E u2.F.


Obvious workaround

cpp -I. -E file.F  file.f90
gfortran -c file.f90