This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH [mainline] - Fix a bug with IMI in crafty



This patch fixes a bug in crafty (SPEC program) when compiling with Intermodule Analysis and
inlining. Attempt to convert an expression to a new type fails because the new type is coming
from a different translation unit.


/* header.h */

struct S {
        int i1;
        int i2;
};

/*foo.c*/

#include "header.h"

int foo(struct S val)
{
        val.i1 = 1;
        val.i2 = 2;

        return val.i1 + val.i2;
}

/* main.c */

#include "header.h"

struct S search;

extern int foo(struct S);

int main()
{
        return foo(search);
}

>>  gcc -c main.c foo.c -O3
main.c: In function `main':
main.c:9: error: conversion to non-scalar type requested


OK for mainline?


- fariborz jahanian (fjahanian@apple.com)

ChangeLog:

2004-03-09 Fariborz Jahanian <fjahanian@apple.com>
* c-convert.c (convert): Make convert work when converting to
compatible types across translation unit.
* tree.h: same_translation_unit_p, tagged_types_tu_compatible_p
decalared extern.
* c-typeck.c: same_translation_unit_p, tagged_types_tu_compatible_p
declared global.



Attachment: ima-crafty-patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]