From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122861 invoked by alias); 27 Feb 2015 15:41:14 -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 122765 invoked by uid 48); 27 Feb 2015 15:41:08 -0000 From: "manu at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/39438] Can't compile a wrapper around strftime with -Werror=format-nonliteral Date: Fri, 27 Feb 2015 16:43:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 4.3.2 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: manu at gcc dot gnu.org X-Bugzilla-Status: NEW 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: keywords bug_status cf_reconfirmed_on everconfirmed Message-ID: In-Reply-To: References: 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: 2015-02/txt/msg03092.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D39438 Manuel L=C3=B3pez-Ib=C3=A1=C3=B1ez changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Status|UNCONFIRMED |NEW Last reconfirmed| |2015-02-27 Ever confirmed|0 |1 --- Comment #10 from Manuel L=C3=B3pez-Ib=C3=A1=C3=B1ez --- (In reply to D. Hugh Redelmeier from comment #6) > If an arg is marked as a const char * (i.e. unchanging) and has the strft= ime > format attribute, it should be accepted as if it were a literal strftime > argument. After all, the necessary checking would have been done at this > routine's points of call. The code that warns is this: gcc/c-family/c-format.c if (res.number_non_literal > 0) { /* Functions taking a va_list normally pass a non-literal format string. These functions typically are declared with first_arg_num =3D=3D 0, so avoid warning in those cases. */ if (!(format_types[info->format_type].flags & (int) FMT_FLAG_ARG_CONVERT)) { /* For strftime-like formats, warn for not checking the format string; but there are no arguments to check. */ warning_at (loc, OPT_Wformat_nonliteral, "format not a string literal, format string not checked"); } Thus, there is nothing checking the attributes of the caller. In the same f= ile there is this code: tree c; for (c =3D TYPE_ATTRIBUTES (TREE_TYPE (current_function_dec= l)); c; c =3D TREE_CHAIN (c)) if (is_attribute_p ("format", TREE_PURPOSE (c)) && (decode_format_type (IDENTIFIER_POINTER (TREE_VALUE (TREE_VALUE (c)))) =3D=3D info.format_type)) break; if (c =3D=3D NULL_TREE) { /* Check if the current function has a parameter to whi= ch the format attribute could be attached; if not, it can't be a candidate for a format attribute, despite the vprintf-like or vscanf-like call. */ tree args; for (args =3D DECL_ARGUMENTS (current_function_decl); args !=3D 0; args =3D DECL_CHAIN (args)) { if (TREE_CODE (TREE_TYPE (args)) =3D=3D POINTER_TYPE && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (args))) =3D=3D char_type_node)) break; } if (args !=3D 0) warning (OPT_Wsuggest_attribute_format, "function mig= ht " "be possible candidate for %qs format attribute", format_types[info.format_type].name); } I'm confident that the above code can be adjusted and moved to the point of= the warning in order to check that the caller of strftime has an attribute form= at of type 'strftime' that refers to the same declaration as the nonliteral fo= rmat argument in the call to strftime, then avoid warning. I'm not planning to w= ork on this though. >>From gcc-bugs-return-478761-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Feb 27 15:43:01 2015 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 127994 invoked by alias); 27 Feb 2015 15:43:01 -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 127044 invoked by uid 48); 27 Feb 2015 15:42:57 -0000 From: "aldyh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/65235] [4.8/4.9/5 Regression] Simplifying vec_select of vec_concat miscompiles when first element of vec_concat is const_int Date: Fri, 27 Feb 2015 16:44:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: aldyh at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ktkachov at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.5 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: 2015-02/txt/msg03093.txt.bz2 Content-length: 230 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65235 --- Comment #4 from Aldy Hernandez --- --target ?? Could you post a preprocessed source code? Hmmm... fine line, but maybe this isn't a regression?