Global Definition Vs Global Declaration

zahed khurasani sdzahed@gmail.com
Thu Apr 5 16:06:00 GMT 2012


> Hmmm, looking at the code, that could be true.
>
> I don't know if there is a way to distinguish these two cases.  I assume
> you've tried passing both decls to debug_tree to see if it shows any
> difference.

Yes I did that. There doesn't seem to be any difference. Here's the output:

extern int extint;
int globalint;

 <var_decl 0xb77137e0 extint
    type <integer_type 0xb76a82a0 int sizes-gimplified public SI
        size <integer_cst 0xb7695258 constant 32>
        unit size <integer_cst 0xb7695090 constant 4>
        align 32 symtab 0 alias set -1 canonical type 0xb76a82a0
precision 32 min <integer_cst 0xb7695210 -2147483648> max <integer_cst
0xb7695228 2147483647>
        pointer_to_this <pointer_type 0xb76a8c00>>
    public external common SI file temp.c line 6 col 12 size
<integer_cst 0xb7695258 32> unit size <integer_cst 0xb7695090 4>
    align 32 chain <var_decl 0xb7713780 globalint>>

 <var_decl 0xb7713780 globalint
    type <integer_type 0xb76a82a0 int sizes-gimplified public SI
        size <integer_cst 0xb7695258 constant 32>
        unit size <integer_cst 0xb7695090 constant 4>
        align 32 symtab 0 alias set -1 canonical type 0xb76a82a0
precision 32 min <integer_cst 0xb7695210 -2147483648> max <integer_cst
0xb7695228 2147483647>
        pointer_to_this <pointer_type 0xb76a8c00>>
    public external common SI file temp.c line 7 col 5 size
<integer_cst 0xb7695258 32> unit size <integer_cst 0xb7695090 4>
    align 32 chain <function_decl 0xb7711e00 main>>

Thanks for your time.

Zahed



More information about the Gcc-help mailing list