This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -pedantic [was Re: Unused dummy argument]


On Dec 7 2012, Steve Kargl wrote:
>
>You may not (and I suspect do not want) to use -pedantic
>because it changes the ranges of the various integer kinds.

Eh?  That's not what the documentation says.  ... I would appreciate
clarification.

The comment does not accurately reflect the old discussion. One can go read the mailing list archive and the PR audit trails to see the full issue. From arith.c,

     /* See PRs 13490 and 17912, related to integer ranges.
	 The pedantic_min_int exists for range checking when a program
	 is compiled with -pedantic, and reflects the belief that
	 Standard Fortran requires integers to be symmetrical, i.e.
	 every negative integer must have a representable positive
	 absolute value, and vice versa.  */

Well, yes, of course. That has always been the case.


Is this line of code portable?

i = iabs(i)

Not if the argument goes outside the symmetric range, and never has been. It's not portable in C, either, despite common belief. But using constants and constant expressions where that occurs is the cause of most of the problems, and is precisely why any author of portable code DOES want a warning! The compiler does not warn on that code, in the absence of other issues.

I have used a system where using that on the most negative integer
aborted the program.


Regards, Nick Maclaren.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]