Re: failure due to compiler?

ok@cs.rmit.edu.au (Richard A. O'Keefe)
22 Jul 1996 10:52:44 -0400

          From comp.compilers

Related articles
[20 earlier articles]
Re: failure due to compiler? gah@u.washington.edu (1996-07-19)
Re: failure due to compiler? ok@cs.rmit.edu.au (1996-07-20)
Re: failure due to compiler? LEEW@FS.MICROLOGIC.COM (Lee Webber) (1996-07-20)
Re: failure due to compiler? iwm@doc.ic.ac.uk (Ian Moor) (1996-07-20)
Re: failure due to compiler? WStreett@shell.monmouth.com (1996-07-20)
Re: failure due to compiler? jgllgher@maths.tcd.ie (Dara Gallagher) (1996-07-20)
Re: failure due to compiler? ok@cs.rmit.edu.au (1996-07-22)
Re: failure due to compiler? rfg@monkeys.com (1996-07-22)
Re: failure due to compiler? leew@micrologic.com (Lee Webber) (1996-07-23)
Re: failure due to compiler? eric@gyst.com (Eric Hamilton) (1996-07-23)
Re: failure due to compiler? davidg@genmagic.com (1996-07-23)
Re: failure due to compiler? davidg@genmagic.com (1996-07-24)
Re: failure due to compiler? jmccarty@sun1307.spd.dsccc.com (1996-07-26)
[2 later articles]
| List of all articles for this month |
From: ok@cs.rmit.edu.au (Richard A. O'Keefe)
Newsgroups: comp.compilers
Date: 22 Jul 1996 10:52:44 -0400
Organization: Comp Sci, RMIT, Melbourne, Australia
References: 96-07-035 96-07-052 96-07-089 96-07-133
Keywords: errors, courses

Ian Moor <iwm@doc.ic.ac.uk> writes:
>The main problem was explaining to a class of beginners progammers
>why their programs failed.


Well, if you want compiler failures that hurt a bunch of beginners,
you really can't go past SPARCompiler Pascal.


The environment:


        y% uname -a
        SunOS yallara 5.5.1 Generic sun4u sparc SUNW,Ultra-Enterprise
        y% pc -V
        pc: SC4.0 18 Oct 1995 Pascal 4.0
        Usage: pc [ options ] files. Use 'pc -flags' for details


The *legal* standard Pascal program:


        y% cat foo.pas
        program foo(output);


var
main: boolean;


        begin


main := true;
writeln(main);


        end.


The result:


        y% pc foo.pas
        y% a.out
        Illegal Instruction (core dumped)


Sun's official reaction is that this isn't a bug, it's a feature.
You see, in this Pascal compiler, all top-level identifiers are
*automatically* also top-level C identifiers. Fortunately, the -s1
option (ISO 7185 level 1) option *now* gives the right answer:


        y% pc -s1 foo.pas
        y% a.out
          TRUE


At the time when I was using Pascal in a course, this apparently
didn't help, and it confused the heck out of the several students
who innocently ran into it.


The compiler otherwise has a lot to commend it. I particularly like
the -Rw option. I wish it supported a few features from the current
standard, though (modules, instead of leaking into C, would be at the
top of the list).


--
Richard A. O'Keefe; http://www.cs.rmit.edu.au/~ok; RMIT Comp.Sci.
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.