http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45742

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-11-12 
23:02:06 UTC ---
(In reply to comment #4)
> >   volatile integer(kind=4) j;

> I see:
> foo (integer(kind=4) & restrict j)
> so the volatile is missing.  Huh?

Seemingly, we have tested different things - I looked a local variable "j"
which works while you looked at a dummy variable, which does not seem to work.
Thus, not a Heisenbug.


If one prints the symbol "j" one gets as backend declaration:

(gdb) p debug_tree (...->symtree->n.sym->backend_decl)
 <parm_decl 0x2aaaace2e880 j
    type <reference_type 0x2aaaacf1d930
        type <integer_type 0x2aaaace37498 integer(kind=4) public SI
            size <integer_cst 0x2aaaace276e0 constant 32>
            unit size <integer_cst 0x2aaaace273e8 constant 4>
            align 32 symtab 0 alias set -1 canonical type 0x2aaaace37498
precision 32 min <integer_cst 0x2aaaace27668 -2147483648> max <integer_cst
0x2aaaace27690 2147483647>
            pointer_to_this <pointer_type 0x2aaaace443f0> reference_to_this
<reference_type 0x2aaaacf1d888>>
        unsigned restrict DI
        size <integer_cst 0x2aaaace277a8 constant 64>
        unit size <integer_cst 0x2aaaace277d0 constant 8>
        align 64 symtab 0 alias set -1 canonical type 0x2aaaacf1d930>
    readonly used unsigned DI passed-by-reference file jfff4322.f90 line 1 col
0 size <integer_cst 0x2aaaace277a8 64> unit size <integer_cst 0x2aaaace277d0 8>
    align 64 context <function_decl 0x2aaaacf1e600 foo> arg-type
<reference_type 0x2aaaacf1d930>>


While for my local variable, one gets:

 <var_decl 0x2aaaacf200a0 j
    type <integer_type 0x2aaaacf1d9d8 integer(kind=4) volatile SI
        size <integer_cst 0x2aaaace276e0 constant 32>
        unit size <integer_cst 0x2aaaace273e8 constant 4>
        align 32 symtab 0 alias set -1 canonical type 0x2aaaacf1d9d8 precision
32 min <integer_cst 0x2aaaace27668 -2147483648> max <integer_cst 0x2aaaace27690
2147483647>>
    volatile used SI file jfff4322.f90 line 2 col 0 size <integer_cst
0x2aaaace276e0 32> unit size <integer_cst 0x2aaaace273e8 4>
    align 32 context <function_decl 0x2aaaacf1e600 foo> chain <var_decl
0x2aaaacf20000 b>>


Thus, the latter properly has the proper values. Seemingly, a THREE_IS_VOLATILE
or TYPE_QUAL_VOLATILE is missing somewhere.

 * * *

For the test case in comment 0 alias comment 3 part one, the reason is clear:
The fold-const.c's fold_build2_stat_loc with code=GT_EXPR always and
unconditionally folds "j > j" to "false".

I have no idea whether that's OK or not - but as a C test case behaves
differently, that's now tracked as PR 46458.

 * * *

Second test case of comment 3: Why is the "volatile" lost between the SSA tree
(-fdump-tree-optimize still has it) and RTL (-fdump-rtl-all, which does not
have any "mem/v" reference)? I am currently looking into that issue.

Reply via email to