public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/45742] VOLATILE has no effect
Date: Fri, 12 Nov 2010 23:06:00 -0000	[thread overview]
Message-ID: <bug-45742-4-M3ydpJgHFG@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-45742-4@http.gcc.gnu.org/bugzilla/>

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.


  parent reply	other threads:[~2010-11-12 23:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-45742-4@http.gcc.gnu.org/bugzilla/>
2010-11-12 20:09 ` tkoenig at gcc dot gnu.org
2010-11-12 20:26 ` burnus at gcc dot gnu.org
2010-11-12 20:55 ` burnus at gcc dot gnu.org
2010-11-12 22:13 ` tkoenig at gcc dot gnu.org
2010-11-12 23:06 ` burnus at gcc dot gnu.org [this message]
2010-11-12 23:34 ` burnus at gcc dot gnu.org
2010-11-12 23:35 ` burnus at gcc dot gnu.org
2010-11-13  0:15 ` burnus at gcc dot gnu.org
2010-11-13  1:15 ` burnus at gcc dot gnu.org
2010-11-13 11:47 ` burnus at gcc dot gnu.org
2010-11-13 12:55 ` burnus at gcc dot gnu.org
2010-11-13 17:31 ` burnus at gcc dot gnu.org
2010-11-13 17:31 ` burnus at gcc dot gnu.org
2010-11-13 17:39 ` burnus at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-45742-4-M3ydpJgHFG@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).