[comp.sys.sgi] Compiler bugs?

XBR2D96D@DDATHD21.BITNET (Knobi der Rechnerschrat) (12/04/89)

Hallo,

  I discovered the following two bugs  in the C and f77 compiler of 3.2. I know
I should report them directly to Calvin Vu, but I've lost his e-mail address.

  First I have the following Fortran Code:

        program test
        write(*,4177)
        numatm = -1
4711    format('Next comes the bug',i4)
     1  numatm
        end

  The program compiles fine, but tell me where does is put the continuation
line? To the format statement? That's nonsense? To the write statement? That
would be the meaning, but to late and it doesn't. I found that one when I
tested the IBM-VS-Fortran product for their AIX/370 system on the 25000 line
MOPAC package. That compiler REALLY test the syntax of programs. It has only
one small flaw. The executable isn't.... Btw. f77 on a 3100 tells me there's
a syntax error following the format statement.

  Second, a colleague asked me to test the following c code on our 4D/70-GT.

#include <stdio.h>
main()
{
int i=0;
if (i) f();
else/*comment*/f1();
}
f()
{return;}
f1()
{return;}

The code compiles fine (that's ok), but ld complains about not finding
_elsef1. That means it just removes the comment without replacing it by a
white space character as stated by K&R. Thats either a violation of K&Rs'
definiton of comments, or a violation of the rule that comments may
appear at places where white space characters are allowed whitout changing
the semantics of the program. The same can be seen on a 3100 running 3.6.

Enjoy
Martin Knoblauch

TH-Darmstadt
Physical Chemistry 1
Petersenstrasse 20
D-6100 Darmstadt, FRG

BITNET: <XBR2D96D@DDATHD21>

davea@quasar.wpd.sgi.com (David B. Anderson) (12/05/89)

In article <8912040056.aa01435@SMOKE.BRL.MIL> XBR2D96D@DDATHD21.BITNET (Knobi der Rechnerschrat) writes:
>Hallo,
>
>  I discovered the following two bugs  in the C and f77 compiler of 3.2. I know
>I should report them directly to Calvin Vu, but I've lost his e-mail address.
[stuff deleted about f77]
>  Second, a colleague asked me to test the following c code on our 4D/70-GT.
[stuff deleted]
>else/*comment*/f1();
[stuff deleted]
>The code compiles fine (that's ok), but ld complains about not finding
>_elsef1. That means it just removes the comment without replacing it by a
>white space character as stated by K&R. Thats either a violation of K&Rs'
>definiton of comments, or a violation of the rule that comments may

We use the traditional AT&T Reiser cpp.  That cpp has, as has been
mentioned many times (in other newgroups, not this one), that /* */
behavior.  Since many programs depend on the erroneous behavior cpp
cannot be changed.

In the release after 3.2, we allow optional use of an ANSI cpp (with
the -acpp flag).     acpp does not exibit the behavior mentioned
by Mr. Rechnerschrat.


Regards,
[ David B. Anderson  Silicon Graphics  (415)335-1548  davea@sgi.com ]

mike@BRL.MIL (Mike Muuss) (12/06/89)

Knobi -

Early (pre-ANSI) C compilers and macro pre-processors all act in the
way that you report.

This behavior is often depended upon to provide "token pasting"
in pre-ANSI compilers.  Please do not attempt to "fix" it.
	Best,
	 -Mike