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 [tree-ssa] - Fix a bug with IMI in crafty



Modified patch to use recently added lang_hooks. ppc-darwin bootstrapped and dejagnu tested.
This now must go to tree-ssa.


OK for tree-ssa?

- Fariborz Jahanian (fjahanian@apple.com)


ChangeLog:


2004-03-08 Fariborz Jahanian <fjahanian@apple.com>

        * c-convert.c (convert): Make convert work when converting to
        compatible types across translation unit.


Index: c-convert.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/c-convert.c,v retrieving revision 1.16.2.3 diff -c -p -r1.16.2.3 c-convert.c *** c-convert.c 13 Feb 2004 13:10:55 -0000 1.16.2.3 --- c-convert.c 18 Mar 2004 21:54:07 -0000 *************** convert (tree type, tree expr) *** 114,119 **** --- 114,122 ---- return fold (convert_to_complex (type, e)); if (code == VECTOR_TYPE) return fold (convert_to_vector (type, e)); + if ((code == RECORD_TYPE || code == UNION_TYPE) + && lang_hooks.types_compatible_p (type, TREE_TYPE (expr))) + return e;

    error ("conversion to non-scalar type requested");
    return error_mark_node;


On Mar 9, 2004, at 12:22 PM, Fariborz Jahanian wrote:



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.



<ima-crafty-patch.txt>


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