public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "chengniansun at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/64439] New: Incorrect location of -Wunused-value or false negative Date: Mon, 29 Dec 2014 19:46:00 -0000 [thread overview] Message-ID: <bug-64439-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64439 Bug ID: 64439 Summary: Incorrect location of -Wunused-value or false negative Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: chengniansun at gmail dot com For the expression "a && ((b = 0) != 0)", GCC warns that the expression value "((b = 0) != 0)" is not used. Should it point to the whole expression rather this sub-expression? Or this is a false negative of -Wunused-value? $: cat s.c void f(int a, int b) { a && ((b = 0) != 0); } $: $: gcc-trunk -c -Wunused-value s.c s.c: In function ‘f’: s.c:2:17: warning: value computed is not used [-Wunused-value] a && ((b = 0) != 0); ^ $: $: clang-trunk -c -Wunused-value s.c s.c:2:5: warning: expression result unused [-Wunused-value] a && ((b = 0) != 0); ~ ^ ~~~~~~~~~~~~~~ 1 warning generated. $: $: >From gcc-bugs-return-471897-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Dec 29 19:54:43 2014 Return-Path: <gcc-bugs-return-471897-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org> Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 21666 invoked by alias); 29 Dec 2014 19:54:43 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: <gcc-bugs.gcc.gnu.org> List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/> List-Post: <mailto:gcc-bugs@gcc.gnu.org> List-Help: <mailto:gcc-bugs-help@gcc.gnu.org> Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 21631 invoked by uid 48); 29 Dec 2014 19:54:38 -0000 From: "anlauf at gmx dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/64432] [5 Regression] SYSTEM_CLOCK(COUNT_RATE=rate) wrong result for integer(4)::rate Date: Mon, 29 Dec 2014 19:54:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gmx dot de X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: fxcoudert at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: <bug-64432-4-NcbGUEwKsl@http.gcc.gnu.org/bugzilla/> In-Reply-To: <bug-64432-4@http.gcc.gnu.org/bugzilla/> References: <bug-64432-4@http.gcc.gnu.org/bugzilla/> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-12/txt/msg02904.txt.bz2 Content-length: 1692 https://gcc.gnu.org/bugzilla/show_bug.cgi?idd432 --- Comment #7 from Harald Anlauf <anlauf at gmx dot de> --- (In reply to Harald Anlauf from comment #5) > (In reply to Francois-Xavier Coudert from comment #4) > > If you have another idea, please post a list of what you think should happen > > in all various cases (all possible combinations of arguments have to be > > allowed). > > Let's see: > > - For any number of arguments present (1, 2 or 3) > - always integer(4): msec resolution (as before) > - always integer(>=8): usec resolution (or whatever is possible) > - always real: I don't care, but I think it might be a good idea > to use the same as for integer of a compatible kind. > - different types and/or kinds: I don't care, since one should > expect problems (wrapping or truncation) anyway. > > But presence of non-presence should never make a difference > if consistent types and kinds are used. I played around with other compilers and posted the result at: https://groups.google.com/forum/?hl=en#!topic/comp.lang.fortran/5aoFFRNBP0g The only compiler that allows for different timer resolutions and produces an at least self-consistent result appears to be Intel. It actually treats each argument separately: if it is a 4-byte argument, it returns values referring to the low-res (0.1 msec) version; for an 8-byte argument one gets the high-res (1 usec) version. (Confirmed by looking at the explicit assembler code). That would be even simpler than any of the versions I discussed above. The actual implementation then might generate a call to _gfortran_system_clock_{4,8} for each present argument, with the respective kind taken into account.
next reply other threads:[~2014-12-29 19:46 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-12-29 19:46 chengniansun at gmail dot com [this message] 2014-12-29 23:44 ` [Bug c/64439] " manu 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-64439-4@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: linkBe 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).