[comp.sys.mips] compiler bug - structs

CCJMB@lure.latrobe.edu.au (01/31/91)

	Could anyone tell me why the following section of code will not
compile on my RISC/OS 4.5.1 when it compiles without error on a VAX and an
IBM RISC/6000 ?

main()
{
   struct strs_struct
   {  char word1[6];
      char word2[6];
   } temp = 
   {"hello", "there" };
}

	It produces the following error message for each field : 
ccom: Error: struct.c, line 8: no automatic aggregate initialization

	Thanks in advance

		Jason (without a sig).

rogerk@MIPS.com (Roger B.A. Klorese) (02/05/91)

In article <5000@lure.latrobe.edu.au> CCJMB@lure.latrobe.edu.au writes:
>	Could anyone tell me why the following section of code will not
>compile on my RISC/OS 4.5.1 when it compiles without error on a VAX and an
>IBM RISC/6000 ?

Because it's a bug, that's why, silly.  ;-)

It's fixed in the now-in-beta 2.20 release, which should ship to contract
customers in April.
-- 
ROGER B.A. KLORESE                                  MIPS Computer Systems, Inc.
MS 6-05    930 DeGuigne Dr.   Sunnyvale, CA  94086              +1 408 524-7421
rogerk@mips.COM         {ames,decwrl,pyramid}!mips!rogerk         "I'm the NLA"
"WAR: been there, done that... hated it."  -- QueerPeace/DAGGER chant

sah@batman (Steve Hanson) (02/08/91)

In article <528@spim.mips.COM>, rogerk@MIPS (Roger B.A. Klorese) writes:
>In article <5000@lure.latrobe.edu.au> CCJMB@lure.latrobe.edu.au writes:
>>	Could anyone tell me why the following section of code will not
>>compile on my RISC/OS 4.5.1 when it compiles without error on a VAX and an
>>IBM RISC/6000 ?
>
>Because it's a bug, that's why, silly.  ;-)
>
>It's fixed in the now-in-beta 2.20 release, which should ship to contract
>customers in April.
>-- 
>ROGER B.A. KLORESE                                  MIPS Computer Systems, Inc.
>MS 6-05    930 DeGuigne Dr.   Sunnyvale, CA  94086              +1 408 524-7421
>rogerk@mips.COM         {ames,decwrl,pyramid}!mips!rogerk         "I'm the NLA"
>"WAR: been there, done that... hated it."  -- QueerPeace/DAGGER chant


Actually the reason lies in the difference between the original K&R 
definition of C, that prohibited initializing unions or automatic
aggregates, and the ANSI C definition that allows it. The IBM 
RISC/6000 compiler is using the ANSI interpretation and the MIPS 2.11
compiler is using the K&R interpretation.