From patchwork Fri Sep 18 18:47:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWFudWVsIEzDs3Blei1JYsOhw7Fleg==?= X-Patchwork-Id: 519517 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41B9D140082 for ; Sat, 19 Sep 2015 04:48:42 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=FXiOp8QO; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; q=dns; s=default; b=Rkw6ytTeyItgbOGIgo rNgUBbLcNvAuzDG5DyIc+jBaNnmEvoOzdE3eBK4+MjeFMpiecsX6wDuYN7SIuqR0 slbRRdQ8wx9qNuHLbqB48itGGmUEo+FU+ni0Y8LVuco/LbiA73mv60wtc4Q50c7u ekQQIbwKCfvIqqLigFv1nyGog= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; s=default; bh=SVH4BuRBojy3k0Fz6bxwWAdT bWw=; b=FXiOp8QOsjD1JwrdB9FSgDp76HIi/z7WQkOzBwN5VYSmNq7sJ/Ej92/h pWGyAzyIlNEk/8Tu3a7LqCTl1FK6qHWX4klnTLO51SvxYUhIRWjCglS9OKflmNRN YlJCvmsdrA8otJxu57cs9YnknwPqCodyGv87FjWCukdEqWpUKUA= Received: (qmail 115503 invoked by alias); 18 Sep 2015 18:48:33 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 115493 invoked by uid 89); 18 Sep 2015 18:48:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-wi0-f178.google.com Received: from mail-wi0-f178.google.com (HELO mail-wi0-f178.google.com) (209.85.212.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 18 Sep 2015 18:48:30 +0000 Received: by wiclk2 with SMTP id lk2so41974176wic.1 for ; Fri, 18 Sep 2015 11:48:27 -0700 (PDT) X-Received: by 10.180.85.164 with SMTP id i4mr18722398wiz.54.1442602107218; Fri, 18 Sep 2015 11:48:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.186.214 with HTTP; Fri, 18 Sep 2015 11:47:47 -0700 (PDT) In-Reply-To: References: From: =?UTF-8?B?TWFudWVsIEzDs3Blei1JYsOhw7Fleg==?= Date: Fri, 18 Sep 2015 20:47:47 +0200 Message-ID: Subject: Re: [PATCH tree-inline] do not say "called from here" with UNKNOWN_LOCATION To: Gcc Patch List , Jakub Jelinek , Richard Biener , Andreas Schwab And now with the patch. On 18 September 2015 at 20:40, Manuel López-Ibáñez wrote: > In https://sourceware.org/ml/libc-alpha/2014-12/msg00300.html, we give a > "called from here" note without actually having a location, which looks > strange. I haven't been able to generate such a testcase. In this patch, we > assert this cannot happen when checking and simply skip the extra note in > release mode. > > Boot&tested on x86_64-linux-gnu > > OK? > > > gcc/testsuite/ChangeLog: > > 2015-09-18 Manuel López-Ibáñez > > * gcc.target/i386/inline_error.c (int bar): Use dg-message for note. > * gcc.target/i386/pr57756.c (static __inline int caller): Likewise. > * gcc.target/i386/pr59789.c (f1): Likewise. > * gcc.target/i386/intrinsics_5.c (__m128i foo): Likewise. > * gcc.target/i386/intrinsics_6.c: Likewise. > * gcc.dg/winline-5.c (int t): Likewise. > * gcc.dg/winline-9.c (t): Likewise. > * gcc.dg/always_inline2.c (q): Likewise. > * gcc.dg/winline-2.c (inline int t): Likewise. > * gcc.dg/winline-6.c: Likewise. > * gcc.dg/winline-10.c (void g): Likewise. > * gcc.dg/pr49243.c (void parse): Likewise. > * gcc.dg/always_inline3.c (q2): Likewise. > * gcc.dg/winline-3.c: Likewise. > * gcc.dg/winline-7.c (inline void *t): Likewise. > > gcc/ChangeLog: > > 2015-09-18 Manuel López-Ibáñez > > * tree-inline.c (expand_call_inline): Use inform for extra note. > Do not give "called from here" with UNKNOWN_LOCATION. Index: gcc/testsuite/gcc.target/i386/inline_error.c =================================================================== --- gcc/testsuite/gcc.target/i386/inline_error.c (revision 227880) +++ gcc/testsuite/gcc.target/i386/inline_error.c (working copy) @@ -7,7 +7,7 @@ foo () /* { dg-error "inlining failed in return 0; } int bar() { - return foo (); /* { dg-error "called from here" } */ + return foo (); /* { dg-message "called from here" } */ } Index: gcc/testsuite/gcc.target/i386/pr57756.c =================================================================== --- gcc/testsuite/gcc.target/i386/pr57756.c (revision 227880) +++ gcc/testsuite/gcc.target/i386/pr57756.c (working copy) @@ -9,11 +9,11 @@ __inline int callee () /* { dg-error "in } __attribute__((target("sse"))) static __inline int caller () { - return callee(); /* { dg-error "called from here" } */ + return callee(); /* { dg-message "called from here" } */ } int main () { return caller(); Index: gcc/testsuite/gcc.target/i386/pr59789.c =================================================================== --- gcc/testsuite/gcc.target/i386/pr59789.c (revision 227880) +++ gcc/testsuite/gcc.target/i386/pr59789.c (working copy) @@ -16,7 +16,7 @@ _mm_set_epi32 (int __q3, int __q2, int _ __m128i f1(void) { /* { dg-message "warning: SSE vector return without SSE enabled changes the ABI" } */ - return _mm_set_epi32 (0, 0, 0, 0); /* { dg-error "called from here" } */ + return _mm_set_epi32 (0, 0, 0, 0); /* { dg-message "called from here" } */ } Index: gcc/testsuite/gcc.target/i386/intrinsics_5.c =================================================================== --- gcc/testsuite/gcc.target/i386/intrinsics_5.c (revision 227880) +++ gcc/testsuite/gcc.target/i386/intrinsics_5.c (working copy) @@ -8,9 +8,9 @@ #include __m128i foo(__m128i *V) { - return _mm_stream_load_si128(V); /* { dg-error "called from here" } */ + return _mm_stream_load_si128(V); /* { dg-message "called from here" } */ } /* { dg-prune-output ".*inlining failed.*" } */ Index: gcc/testsuite/gcc.target/i386/intrinsics_6.c =================================================================== --- gcc/testsuite/gcc.target/i386/intrinsics_6.c (revision 227880) +++ gcc/testsuite/gcc.target/i386/intrinsics_6.c (working copy) @@ -8,9 +8,9 @@ #include __m128i foo(__m128i *V) { - return _mm_stream_load_si128(V); /* { dg-error "called from here" } */ + return _mm_stream_load_si128(V); /* { dg-message "called from here" } */ } /* { dg-prune-output ".*inlining failed.*" } */ Index: gcc/testsuite/gcc.dg/winline-5.c =================================================================== --- gcc/testsuite/gcc.dg/winline-5.c (revision 227880) +++ gcc/testsuite/gcc.dg/winline-5.c (working copy) @@ -15,7 +15,7 @@ inline int q(void) /* { dg-warning "inli big(); big(); } int t (void) { - return q (); /* { dg-warning "called from here" } */ + return q (); /* { dg-message "called from here" } */ } Index: gcc/testsuite/gcc.dg/winline-9.c =================================================================== --- gcc/testsuite/gcc.dg/winline-9.c (revision 227880) +++ gcc/testsuite/gcc.dg/winline-9.c (working copy) @@ -20,7 +20,7 @@ int t() { if (a) aa(); if (b) - bb(); /* { dg-warning "called from here" "" } */ + bb(); /* { dg-message "called from here" "" } */ } Index: gcc/testsuite/gcc.dg/always_inline2.c =================================================================== --- gcc/testsuite/gcc.dg/always_inline2.c (revision 227880) +++ gcc/testsuite/gcc.dg/always_inline2.c (working copy) @@ -2,7 +2,7 @@ /* { dg-options "-O2 -fgnu89-inline" } */ inline __attribute__ ((always_inline)) void t(void); /* { dg-error "body not available" } */ void q(void) { - t(); /* { dg-error "called from here" } */ + t(); /* { dg-message "called from here" } */ } Index: gcc/testsuite/gcc.dg/winline-2.c =================================================================== --- gcc/testsuite/gcc.dg/winline-2.c (revision 227880) +++ gcc/testsuite/gcc.dg/winline-2.c (working copy) @@ -2,7 +2,7 @@ /* { dg-options "-Winline -O2 -fgnu89-inline" } */ inline int q(void); /* { dg-warning "body not available" "" } */ inline int t(void) { - return q(); /* { dg-warning "called from here" "" } */ + return q(); /* { dg-message "called from here" "" } */ } Index: gcc/testsuite/gcc.dg/winline-6.c =================================================================== --- gcc/testsuite/gcc.dg/winline-6.c (revision 227880) +++ gcc/testsuite/gcc.dg/winline-6.c (working copy) @@ -15,7 +15,7 @@ inline int q(void) /* { dg-warning "larg big(); big(); } inline int t (void) { - return q () + 1; /* { dg-warning "called from here" } */ + return q () + 1; /* { dg-message "called from here" } */ } Index: gcc/testsuite/gcc.dg/winline-10.c =================================================================== --- gcc/testsuite/gcc.dg/winline-10.c (revision 227880) +++ gcc/testsuite/gcc.dg/winline-10.c (working copy) @@ -9,9 +9,9 @@ inline void f (x) /* { dg-warning "inlin asm (""); } void g (struct s x) { - f (x); /* { dg-warning "called from here" "" } */ + f (x); /* { dg-message "called from here" "" } */ } void f (int x); /* { dg-warning "follows non-prototype definition" } */ Index: gcc/testsuite/gcc.dg/pr49243.c =================================================================== --- gcc/testsuite/gcc.dg/pr49243.c (revision 227880) +++ gcc/testsuite/gcc.dg/pr49243.c (working copy) @@ -18,8 +18,8 @@ static inline int wrapper(const char **s } void parse(const char *data) { const char *s = data; - if (!(wrapper(&s) == -1 && (s - data) == 1)) /* { dg-warning "called from here" } */ + if (!(wrapper(&s) == -1 && (s - data) == 1)) /* { dg-message "called from here" } */ __builtin_abort(); } Index: gcc/testsuite/gcc.dg/always_inline3.c =================================================================== --- gcc/testsuite/gcc.dg/always_inline3.c (revision 227880) +++ gcc/testsuite/gcc.dg/always_inline3.c (working copy) @@ -4,8 +4,8 @@ int do_something_evil (void); inline __attribute__ ((always_inline)) void q2(void) /* { dg-error "recursive inlining" } */ { if (do_something_evil ()) return; - q2(); /* { dg-error "called from here" } */ + q2(); /* { dg-message "called from here" } */ q2(); /* With -O2 we don't warn here, it is eliminated by tail recursion. */ } Index: gcc/testsuite/gcc.dg/winline-3.c =================================================================== --- gcc/testsuite/gcc.dg/winline-3.c (revision 227880) +++ gcc/testsuite/gcc.dg/winline-3.c (working copy) @@ -15,7 +15,7 @@ inline int q(void) /* { dg-warning "max- big(); big(); } inline int t (void) { - return q (); /* { dg-warning "called from here" "" } */ + return q (); /* { dg-message "called from here" "" } */ } Index: gcc/testsuite/gcc.dg/winline-7.c =================================================================== --- gcc/testsuite/gcc.dg/winline-7.c (revision 227880) +++ gcc/testsuite/gcc.dg/winline-7.c (working copy) @@ -9,7 +9,7 @@ inline void *q (void) /* { dg-warning "( { return alloca (10); } inline void *t (void) { - return q (); /* { dg-warning "called from here" } */ + return q (); /* { dg-message "called from here" } */ } Index: gcc/tree-inline.c =================================================================== --- gcc/tree-inline.c (revision 227880) +++ gcc/tree-inline.c (working copy) @@ -4452,11 +4452,14 @@ expand_call_inline (basic_block bb, gimp /* PR 20090218-1_0.c. Body can be provided by another module. */ && (reason != CIF_BODY_NOT_AVAILABLE || !flag_generate_lto)) { error ("inlining failed in call to always_inline %q+F: %s", fn, cgraph_inline_failed_string (reason)); - error ("called from here"); + if (input_location != UNKNOWN_LOCATION) + /* ??? Use gimple_location (stmt) instead ? */ + inform (input_location, "called from here"); + gcc_checking_assert (input_location != UNKNOWN_LOCATION); } else if (warn_inline && DECL_DECLARED_INLINE_P (fn) && !DECL_NO_INLINE_WARNING_P (fn) && !DECL_IN_SYSTEM_HEADER (fn) @@ -4465,13 +4468,19 @@ expand_call_inline (basic_block bb, gimp /* Do not warn about not inlined recursive calls. */ && !cg_edge->recursive_p () /* Avoid warnings during early inline pass. */ && symtab->global_info_ready) { - warning (OPT_Winline, "inlining failed in call to %q+F: %s", - fn, _(cgraph_inline_failed_string (reason))); - warning (OPT_Winline, "called from here"); + /* FIXME: input_location should never be UNKNOWN_LOCATION + here, but it seems it can happen: + https://sourceware.org/ml/libc-alpha/2014-12/msg00300.html */ + if (warning (OPT_Winline, "inlining failed in call to %q+F: %s", + fn, _(cgraph_inline_failed_string (reason))) + && input_location != UNKNOWN_LOCATION) + /* ??? Use gimple_location (stmt) instead ? */ + inform (input_location, "called from here"); + gcc_checking_assert (input_location != UNKNOWN_LOCATION); } goto egress; } fn = cg_edge->callee->decl; cg_edge->callee->get_untransformed_body (); @@ -4532,10 +4541,11 @@ expand_call_inline (basic_block bb, gimp not refer to them in any way to not break GC for locations. */ if (gimple_block (stmt)) { id->block = make_node (BLOCK); BLOCK_ABSTRACT_ORIGIN (id->block) = fn; + /* FIXME: gimple_location (stmt) ? */ BLOCK_SOURCE_LOCATION (id->block) = LOCATION_LOCUS (input_location); prepend_lexical_block (gimple_block (stmt), id->block); } /* Local declarations will be replaced by their equivalents in this