This is the mail archive of the gcc@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]

Re: Mismatched types in ADDR_EXPR from c-typeck.c:build_function_call


On 5/18/05, Richard Guenther <rguenth@tat.physik.uni-tuebingen.de> wrote:
> 
> The following snippet
> 
>       /* Differs from default_conversion by not setting TREE_ADDRESSABLE
>          (because calling an inline function does not mean the function
>          needs to be separately compiled).  */
>       fntype = build_type_variant (TREE_TYPE (function),
>                                    TREE_READONLY (function),
>                                    TREE_THIS_VOLATILE (function));
>       fundecl = function;
>       function = build1 (ADDR_EXPR, build_pointer_type (fntype),
> function);
> 
> purposely builds an ADDR_EXPR tree with mismatched types:
> 
>  <addr_expr 0x4028c940
>     type <pointer_type 0x40290510
>         type <function_type 0x402904a4 type <integer_type 0x40149510 int>
>             readonly QI
>        ....
>     readonly constant invariant
>     arg 0 <function_decl 0x4018f870 __builtin_constant_p
>         type <function_type 0x40158360 type <integer_type 0x40149510 int>
>             QI
>        ....
> 
> why?  Do we (want to) allow this kind of mismatch in ADDR_EXPRs?

Allowing ADDR_EXPR with types that share the same TYPE_MAIN_VARIANT
makes these things in the C forntend a non-issue.  This may be one hint that
we do not want a (very) strict type system.

Richard.


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