public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: g77 compiles illegal code in testsuite?
@ 2003-05-23 12:57 Bud Davis
  2003-05-23 14:23 ` Paul Brook
  2003-05-23 15:15 ` Steven G. Kargl
  0 siblings, 2 replies; 7+ messages in thread
From: Bud Davis @ 2003-05-23 12:57 UTC (permalink / raw)
  To: kargl, gcc

| I'm running the Fortran 77 code in gcc-testsuite-3.3.tar.bz2
| through g95 and I've found that 20000601-2.f contains
| illegal code for Fortran 95 and probably Fortran 77.  I don't
| have the Fortran 77 standard handy, but I believe the code is
| illegal; yet g77 compiles the code without warning or error. 


steven,

First off, IANALL (i am not a language lawyer).  The info below
is the analysis of a FORTRAN programmer who uses UPPER CASE for 
all variable names and never exceeds column 72 :)

From the F77 standard (selectively cut and pasted):

___________________________________________________________________________________________
|                   |/                 /|          |        |         |                     |
|                   |/                 /| Number of| Generic| Specific|       Type of       |
|Intrinsic Function | Definition/      /| Arguments|  Name  | Name    | Argument | Function |
|___________________|/_________________/|__________|________|_________|__________|__________|
|                   |/                 /|          |        |         |          |          |
|                   |/                 /|          |        |         |          |          |
|Choosing Largest   | max(/a/ ,/a/ ,...)  |    >=2   | MAX    | MAX0    | Integer  | Integer  |
|  Value            |      1  2/       /|          |        | AMAX1   | Real     | Real     |
|                   |/                 /|          |        | DMAX1   | Double   | Double   |
|                   |/                 /|          |________|_________|__________|__________|
|                   |/                 /|          |        | AMAX0   | Integer  | Real     |
|                   |/                 /|          |        | MAX1    | Real     | Integer  |
|___________________|/_________________/|__________|________|_________|__________|_________ |


In my interpretation, the code in question is not valid. MAX is the generic name for MAX0,AMAX1, and DMAX1, 
not for AMAX0 which is the specfic intrinisic needed here.


Just to confuse things more, i compiled this snippet

        INTEGER I
        REAL R,NUM
        NUM=MAX(I,R)
        END

on a few f77 compilers:

sgi - MIPSPro-77 --   Compiles without warnings or errors
dec - f90 /f77   --   Fatal Error on type mismatch

  
Maybe g77 should issue a warning (when invoked with -fpedantic) ?

Of course, IMHO, g95 should be backwards compatable with g77 :)

regards,
bud davis





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

* Re: g77 compiles illegal code in testsuite?
  2003-05-23 12:57 g77 compiles illegal code in testsuite? Bud Davis
@ 2003-05-23 14:23 ` Paul Brook
  2003-05-23 15:15 ` Steven G. Kargl
  1 sibling, 0 replies; 7+ messages in thread
From: Paul Brook @ 2003-05-23 14:23 UTC (permalink / raw)
  To: Bud Davis, kargl, gcc

On Friday 23 May 2003 1:34 pm, Bud Davis wrote:
> Just to confuse things more, i compiled this snippet
>
>         INTEGER I
>         REAL R,NUM
>         NUM=MAX(I,R)
>         END
>
> on a few f77 compilers:
>
> sgi - MIPSPro-77 --   Compiles without warnings or errors
> dec - f90 /f77   --   Fatal Error on type mismatch
>
>
> Maybe g77 should issue a warning (when invoked with -fpedantic) ?
>
> Of course, IMHO, g95 should be backwards compatable with g77 :)

G95 currently allows different type kinds (ie. double or single precision) as 
an extension, but not different types. It could easily be modified to accept 
different types. I've no idea how easy/hard it would be to get g77 to do 
something similar.

As this code is non-portable and techincally illegal a warning is issued. This 
becomes an error with -pedantic.

Paul

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

* Re: g77 compiles illegal code in testsuite?
  2003-05-23 12:57 g77 compiles illegal code in testsuite? Bud Davis
  2003-05-23 14:23 ` Paul Brook
@ 2003-05-23 15:15 ` Steven G. Kargl
  2003-05-23 15:36   ` Bud Davis
  2003-05-23 22:57   ` Toon Moene
  1 sibling, 2 replies; 7+ messages in thread
From: Steven G. Kargl @ 2003-05-23 15:15 UTC (permalink / raw)
  To: Bud Davis; +Cc: gcc

Bud Davis said:
> | I'm running the Fortran 77 code in gcc-testsuite-3.3.tar.bz2
> | through g95 and I've found that 20000601-2.f contains
> | illegal code for Fortran 95 and probably Fortran 77.  I don't
> | have the Fortran 77 standard handy, but I believe the code is
> | illegal; yet g77 compiles the code without warning or error. 
> 

[Table of intrinsics snipped]

> In my interpretation, the code in question is not valid.
> MAX is the generic name for MAX0,AMAX1, and DMAX1, 

This is correct.

> not for AMAX0 which is the specfic intrinisic needed here.

Actually, I beleive AMAX0 would also be wrong.  The arguments
of AMAX0 must have the same type.

>   
> Maybe g77 should issue a warning (when invoked with -fpedantic) ?
> 

It's Toon's call, but I think g77 should issue an error and
abort.  The g77 info contains a -fno-ugly-args option.  I
would think you should need -fugly-args to compile the code
in question.

> Of course, IMHO, g95 should be backwards compatable with g77 :)

This may not happen, because Fortran 95 has deleted a few
features from Fortran 77.

-- 
Steve
http://troutmask.apl.washington.edu/~kargl/

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

* Re: g77 compiles illegal code in testsuite?
  2003-05-23 15:15 ` Steven G. Kargl
@ 2003-05-23 15:36   ` Bud Davis
  2003-05-23 22:57   ` Toon Moene
  1 sibling, 0 replies; 7+ messages in thread
From: Bud Davis @ 2003-05-23 15:36 UTC (permalink / raw)
  To: Steven G. Kargl; +Cc: gcc

Steven G. Kargl wrote:

>Bud Davis said:
>  
>
>>| I'm running the Fortran 77 code in gcc-testsuite-3.3.tar.bz2
>>| through g95 and I've found that 20000601-2.f contains
>>| illegal code for Fortran 95 and probably Fortran 77.  I don't
>>| have the Fortran 77 standard handy, but I believe the code is
>>| illegal; yet g77 compiles the code without warning or error. 
>>
>>    
>>
>
>[Table of intrinsics snipped]
>
>  
>
>>In my interpretation, the code in question is not valid.
>>MAX is the generic name for MAX0,AMAX1, and DMAX1, 
>>    
>>
>
>This is correct.
>
>  
>
>>not for AMAX0 which is the specfic intrinisic needed here.
>>    
>>
>
>Actually, I beleive AMAX0 would also be wrong.  The arguments
>of AMAX0 must have the same type.
>
>  
>
>>  
>>Maybe g77 should issue a warning (when invoked with -fpedantic) ?
>>
>>    
>>
>
>It's Toon's call, but I think g77 should issue an error and
>abort.  The g77 info contains a -fno-ugly-args option.  I
>would think you should need -fugly-args to compile the code
>in question.
>
>  
>
>>Of course, IMHO, g95 should be backwards compatable with g77 :)
>>    
>>
>
>This may not happen, because Fortran 95 has deleted a few
>features from Fortran 77.
>
>  
>

quite right about AMAX0. it would not be correct. i read the table wrong :)




--bud davis


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

* Re: g77 compiles illegal code in testsuite?
  2003-05-23 15:15 ` Steven G. Kargl
  2003-05-23 15:36   ` Bud Davis
@ 2003-05-23 22:57   ` Toon Moene
  2003-05-23 23:40     ` Steven Bosscher
  1 sibling, 1 reply; 7+ messages in thread
From: Toon Moene @ 2003-05-23 22:57 UTC (permalink / raw)
  To: Steven G. Kargl; +Cc: Bud Davis, gcc

Steven G. Kargl wrote:

> It's Toon's call, but I think g77 should issue an error and
> abort.  The g77 info contains a -fno-ugly-args option.  I
> would think you should need -fugly-args to compile the code
> in question.

I think I agree with that stance.

>>Of course, IMHO, g95 should be backwards compatable with g77 :)

> This may not happen, because Fortran 95 has deleted a few
> features from Fortran 77.

Ah yes, the language has.  However, as compiler writers we could decide 
to include the complete language g77 compiles into the language g95 
compiles.

This would have the obvious benefit of making g77 superfluous and 
reducing our maintenance burden.

-- 
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://gcc-g95.sourceforge.net/ (under construction)

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

* Re: g77 compiles illegal code in testsuite?
  2003-05-23 22:57   ` Toon Moene
@ 2003-05-23 23:40     ` Steven Bosscher
  0 siblings, 0 replies; 7+ messages in thread
From: Steven Bosscher @ 2003-05-23 23:40 UTC (permalink / raw)
  To: Toon Moene; +Cc: gcc

Toon Moene wrote:

>>> Of course, IMHO, g95 should be backwards compatable with g77 :)
>>
>
>> This may not happen, because Fortran 95 has deleted a few
>> features from Fortran 77.
>
>
> Ah yes, the language has.  However, as compiler writers we could 
> decide to include the complete language g77 compiles into the language 
> g95 compiles.
>
> This would have the obvious benefit of making g77 superfluous and 
> reducing our maintenance burden.

Well, it it would make G95 more difficult to maintain as well.  Many of 
the features we're talking about are the ones that are the ugliest to 
implement correctly.  And let's not forget that these features were 
removed for good reasons.

BTW The only reason why so many people still code F77 probably is that 
there is no G95 :-)
Anyone who really cares that much about backward compatibility can still 
always use an older g77.

Greetz
Steven


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

* g77 compiles illegal code in testsuite?
@ 2003-05-23  3:33 Steven G. Kargl
  0 siblings, 0 replies; 7+ messages in thread
From: Steven G. Kargl @ 2003-05-23  3:33 UTC (permalink / raw)
  To: gcc

I'm running the Fortran 77 code in gcc-testsuite-3.3.tar.bz2
through g95 and I've found that 20000601-2.f contains
illegal code for Fortran 95 and probably Fortran 77.  I don't
have the Fortran 77 standard handy, but I believe the code is
illegal; yet g77 compiles the code without warning or error. 

kargl[303] f77 -v -c 20000601-2.f
Using built-in specs.
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.2.2 [FreeBSD] 20030205 (release)

kargl[305] f95 -V -fixed -dusty 20000601-2.f
NAGWare Fortran 95 compiler Release 4.2(468)
Copyright 1990-2002 The Numerical Algorithms Group Ltd., Oxford, U.K.
f95comp version is 4.2(468)
Warning: 20000601-2.f, line 27: Unused symbol WORK31
         detected at END@<end-of-statement>
Warning: 20000601-2.f, line 27: Unused symbol WORK13
         detected at END@<end-of-statement>
[f95 continuing despite warning messages]
Obsolescent: 20000601-2.f, line 1: Fixed source form
Error: 20000601-2.f, line 21: Inconsistent argument data types to intrinsic MAX

kargl[318] ../../../../bin/g95 -ffixed-form -c -x f95 20000601-2.f
 In file 20000601-2.f:21

            JP = MAX( KM+1, AB( KV+1, JJ ) )
                          1
Error: 'a2' argument of 'max' intrinsic at (1) must be INTEGER(4)

-- 
Steve
http://troutmask.apl.washington.edu/~kargl/

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

end of thread, other threads:[~2003-05-23 23:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-23 12:57 g77 compiles illegal code in testsuite? Bud Davis
2003-05-23 14:23 ` Paul Brook
2003-05-23 15:15 ` Steven G. Kargl
2003-05-23 15:36   ` Bud Davis
2003-05-23 22:57   ` Toon Moene
2003-05-23 23:40     ` Steven Bosscher
  -- strict thread matches above, loose matches on Subject: below --
2003-05-23  3:33 Steven G. Kargl

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