[2568] in Athena Bugs

home help back first fref pref prev next nref lref last post

hc2.1: initialized array address plus offset

daemon@ATHENA.MIT.EDU (Ken Raeburn)
Fri Jul 14 17:59:27 1989

Date: Fri, 14 Jul 89 17:59:05 -0400
From: Ken Raeburn <raeburn@ATHENA.MIT.EDU>
To: bugs@ATHENA.MIT.EDU, mckie@ATHENA.MIT.EDU, wdc@ATHENA.MIT.EDU
Cc: rfrench@ATHENA.MIT.EDU

The following routine (stripped down from the file in Rob's earlier
report), which sets a pointer to just past the end of a 150K array:

    /*
     * test of hc2.1o bug
     */

    extern char *x;
    int i[150000 / sizeof (int)] = {
	0,
    };

    void foo () {
	x = (char *) i + 150000;
    }

causes hc2.1o to complain:

     [prometheus!raeburn:/tmp]
    <1019  5:37pm> % hc2 -O -S foo.c
    >>>>>>>>   S Y S T E M   E R R O R   1   <<<<<<<<, in code_gen
    LDA R0,M!!!
    >>>>>>>>   S Y S T E M   E R R O R   2   <<<<<<<<, in gen
    LOAD r0,X!!!
    at line 11
    Exit 16              hc2 -O -S foo.c
     [prometheus!raeburn:/tmp]
    <1020  5:38pm> %

The messages go away if "i" is assigned to a temporary variable before
being added, or if the array is uninitialized.

Bill Cattey's copy of 2.1r also complains with the same message,
though I haven't tried the variations that fixed the example under
2.1o.

home help back first fref pref prev next nref lref last post