From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18163 invoked by alias); 29 Dec 2014 19:46:19 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 18135 invoked by uid 48); 29 Dec 2014 19:46:15 -0000 From: "chengniansun at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: chengniansun at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-12/txt/msg02903.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D64439 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 =3D 0) !=3D 0)", GCC warns that the expression= value "((b =3D 0) !=3D 0)" is not used. Should it point to the whole expression r= ather this sub-expression? Or this is a false negative of -Wunused-value? $: cat s.c=20 void f(int a, int b) {=20 a && ((b =3D 0) !=3D 0);=20 } $:=20 $: gcc-trunk -c -Wunused-value s.c=20 s.c: In function =E2=80=98f=E2=80=99: s.c:2:17: warning: value computed is not used [-Wunused-value] a && ((b =3D 0) !=3D 0);=20 ^ $:=20 $: clang-trunk -c -Wunused-value s.c s.c:2:5: warning: expression result unused [-Wunused-value] a && ((b =3D 0) !=3D 0);=20 ~ ^ ~~~~~~~~~~~~~~ 1 warning generated. $:=20 $: >>From gcc-bugs-return-471897-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Dec 29 19:54:43 2014 Return-Path: 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: List-Archive: List-Post: List-Help: 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" 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: In-Reply-To: References: 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?id=64432 --- Comment #7 from Harald Anlauf --- (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.