g77 -O3 -ggdb -> "Internal compiler error"

craig@jcb-sc.com craig@jcb-sc.com
Sat May 15 00:04:00 GMT 1999

>not very important, but:
>The following FORTRAN code results in an Internal compiler error on
>i686-pc-linux-gnulibc1 for both egcs-ss-19990502 and egcs-1.1.2 when
>invoking the compiler with both -ggdb and -O3:
>(of course, this is not a likely or even useful combination, but the
>compiler told me to issue a bug report:-)

It's important.  And I've long wondered when we might get a bug report
like this.

Unfortunately, *fixing* it is not exactly trivial, but maybe I can
manage to do it in time for 1.2.

Oh, I should mention, the test case is buggy, in that it'd do undefined
things at run time, should the procedure ever be called.

(I haven't actually investigated the problem, but offhand it looks
pretty clear to me that the problem is the result of a combination
of g77 permitting the back end to inline `a' within `b', `b' passing
a constant by reference to `a', and `a' modifying that constant via
its argument.  g77 0.5.20 had all sorts of problems with this sort
of thing generally, inlining having been introduced for that release,
so 0.5.21 included code to detect and diagnose the kinds of errors
that might, if not caught, show up later as back-end crashes.  Those
changes included checking for return-type, argument count, and argument
type compatibility, but, until now, we've gotten away with not bothering
to check argument read/write/modify compatibility.  The g77 front end
currently doesn't keep track of whether a given variable is used in
a read, write, and/or modify context, so that will have to be added
to support the appropriate diagnostics.  Once added, other Happy Things
will probably come of it.)

        tq vm, (burley)

More information about the Gcc-bugs mailing list