From patchwork Mon Dec 1 07:21:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Endo X-Patchwork-Id: 416314 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 CBCAB14017B for ; Mon, 1 Dec 2014 18:21:29 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:subject:from:to:date:content-type:mime-version; q= dns; s=default; b=xmKYHFOeug4tfA9JuXkx8cA1+mmE0Y377ukWd5jTrO7Vp8 P1z+oYvIP9suxp1WhJF7OJW76PzIE+rXORTzcd52Jp8JxgHqRwBE+WmRYulNr3L1 FoVaV797kV++NWbFf3SSH9TxcZ0bhBhToKG370i2/3EdeSaAchs2Cfw/0I3ws= 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 :message-id:subject:from:to:date:content-type:mime-version; s= default; bh=/tz2kYjGzLPJtrJcXkS/VCaZyCw=; b=EfwuGFHOIpxo/9NY0lUJ WKD7p0uISyqeOGeGwQw+g6Qa2zDH7u+O5mi6ZJCDD8k1jTc6LpXA761WayJMrYbm G8b0VtuIiFg8W5uvahJSndukgft7SbBIHwMAafF7zbTIqgtxhjaP+wzk5fhkzFUa NpiTfpWvGrhbVmEcjotQWQE= Received: (qmail 32325 invoked by alias); 1 Dec 2014 07:21:23 -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 32315 invoked by uid 89); 1 Dec 2014 07:21:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mailout11.t-online.de Received: from mailout11.t-online.de (HELO mailout11.t-online.de) (194.25.134.85) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 01 Dec 2014 07:21:20 +0000 Received: from fwd10.aul.t-online.de (fwd10.aul.t-online.de [172.20.26.152]) by mailout11.t-online.de (Postfix) with SMTP id E088F22E9B7 for ; Mon, 1 Dec 2014 08:21:15 +0100 (CET) Received: from [192.168.0.106] (Tl3vyqZYghOxeGlvZBLbfWmWUgtRWXi7-J1DAnW4Xj4pidOGZVcfCeV11WNhVCzgkH@[84.180.116.254]) by fwd10.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-SHA encrypted) esmtp id 1XvLIG-2yLdpo0; Mon, 1 Dec 2014 08:21:12 +0100 Message-ID: <1417418467.3387.89.camel@yam-132-YW-E178-FTW> Subject: [testsuite] Fix multiple definitions of _init From: Oleg Endo To: gcc-patches Date: Mon, 01 Dec 2014 08:21:07 +0100 Mime-Version: 1.0 X-IsSubscribed: yes Hi, When running the testsuite on a sh-elf configuration, some test cases fail due to multiple definitions of the function '_init'. This is because on sh-elf every function is automatically prefixed with a '_' char. When defining a C function 'init' in some code, the actual name becomes '_init' and this conflicts with the _init function in libgcc (crti.S). While the behavior of adding the '_' prefix is debatable, the testsuite failures can be easily fixed by the attached patch. Is this OK for trunk? Cheers, Oleg gcc/testsuite/ChangeLog: * gcc.c-torture/execute/20120919-1.c (init): Rename to initt. * gcc.c-torture/execute/pr42248.c: Likewise. * gcc.c-torture/execute/pr53688.c: Likewise. * gcc.c-torture/execute/pr42614.c: Likewise. Index: gcc/testsuite/gcc.c-torture/execute/20120919-1.c =================================================================== --- gcc/testsuite/gcc.c-torture/execute/20120919-1.c (revision 218199) +++ gcc/testsuite/gcc.c-torture/execute/20120919-1.c (working copy) @@ -9,9 +9,9 @@ extern void abort(void); -void init (int *n, int *dummy) __attribute__ ((noinline,noclone)); +void initt (int *n, int *dummy) __attribute__ ((noinline,noclone)); -void init (int *n, int *dummy) +void initt (int *n, int *dummy) { if(0 == n) dummy[0] = 0; } @@ -20,7 +20,7 @@ { int dummy[1532]; int i = -1, n = 1, s = 0; - init (&n, dummy); + initt (&n, dummy); while (i < n) { if (i == 0) { if (pd[i] > 0) { Index: gcc/testsuite/gcc.c-torture/execute/pr42248.c =================================================================== --- gcc/testsuite/gcc.c-torture/execute/pr42248.c (revision 218199) +++ gcc/testsuite/gcc.c-torture/execute/pr42248.c (working copy) @@ -12,7 +12,7 @@ } void -init (Scf10 *p, _Complex double y) +initt (Scf10 *p, _Complex double y) { p->a = y; } @@ -20,7 +20,7 @@ int main () { - init (&g1s, (_Complex double)1); + initt (&g1s, (_Complex double)1); check (g1s, (_Complex double)1); return 0; Index: gcc/testsuite/gcc.c-torture/execute/pr53688.c =================================================================== --- gcc/testsuite/gcc.c-torture/execute/pr53688.c (revision 218199) +++ gcc/testsuite/gcc.c-torture/execute/pr53688.c (working copy) @@ -5,7 +5,7 @@ } p; void __attribute__((noinline,noclone)) -init() +initt() { __builtin_memcpy (p.part1, "FOOBARFOO", sizeof (p.part1)); __builtin_memcpy (p.part2, "SPEC CPU", sizeof (p.part2)); @@ -15,7 +15,7 @@ { char *x; int c; - init(); + initt(); __builtin_memcpy (&headline[0], p.part1, 9); c = 9; x = &headline[0]; Index: gcc/testsuite/gcc.c-torture/execute/pr42614.c =================================================================== --- gcc/testsuite/gcc.c-torture/execute/pr42614.c (revision 218199) +++ gcc/testsuite/gcc.c-torture/execute/pr42614.c (working copy) @@ -12,7 +12,7 @@ TEntry data[2]; } TTable; -TTable *init () +TTable *initt () { return malloc(sizeof(TTable)); } @@ -54,7 +54,7 @@ main () { unsigned char index = 0; - TTable *table_p = init(); + TTable *table_p = initt(); TEntry work; inlined_wrong (&(table_p->data[1]), 1);