[gnu.gcc.bug] number cast to pointer to structure

raeburn@ATHENA.MIT.EDU (Ken Raeburn) (05/01/89)

GCC version: 1.35, vax.

Input file:

    /*
     * foo
     */

    struct s1 {
	int s1_one;
	int s1_two;
    };

    struct s2 {
	int s2_one;
	struct s1 s2_s1;
	int s2_two;
    };

    struct s3 {
	int s3_one;
	int s3_two;
	struct s2 s3_s2;
    };

    #ifndef BUG
    struct s3 * FOO;
    #else
    #define FOO ((struct s3 *)0x3700)
    #endif

    #define BAR	(FOO->s3_s2)		/* struct s2	*/
    #define QUUX	(&(BAR))	/* struct s2 *	*/

    extern void *xxx;

    void foo () {
	xxx = &BAR.s2_s1;
	xxx = &QUUX->s2_s1;		/* line 35 */
    }

Output:

    % gcc -S quux.c -DBUG
    quux.c: In function foo:
    quux.c:35: structure has no member named `s2_s1'

The file compiles properly when BUG is not defined; as I read it,
shouldn't the type of FOO be the same?

-- Ken