public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64332] New: gcc/g++ handles system_header differently
@ 2014-12-16 16:06 a3at.mail at gmail dot com
  2014-12-16 16:46 ` [Bug c++/64332] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: a3at.mail at gmail dot com @ 2014-12-16 16:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64332

            Bug ID: 64332
           Summary: gcc/g++ handles system_header differently
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: a3at.mail at gmail dot com

Created attachment 34292
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34292&action=edit
warning-constructor-attribute-ignored.tgz

Digging through one or compilation errors, after doing this:
#define __constructor __attribute__((constructor))

I turned out that gcc/g++ have different behaviours for system_header pragma.

Here is a simple example (also archived in attach):
$ head *.[ch]
==> c.h <==
#define __constructor __attribute__((constructor))

==> c-impl.h <==
#pragma GCC system_header

typedef void (*__cb_type)(void *);
int foo(__cb_type __constructor);

==> main.c <==
#include "c.h"
#include "c-impl.h"

$ gcc -c main.c
$ gcc -Wall -Wextra -Wpedantic -Wattributes -c main.c
$ g++ -c main.c
In file included from main.c:1:0:
c.h:1:50: warning: ‘constructor’ attribute ignored [-Wattributes]
 #define __constructor __attribute__((constructor))
$ clang++-3.5 -c main.c
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is
deprecated
$ clang-3.5 -c main.c

$ g++ --version
g++ (Debian 4.9.1-16) 4.9.1
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Is this desired behavior?
>From gcc-bugs-return-470892-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Dec 16 16:10:22 2014
Return-Path: <gcc-bugs-return-470892-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 24444 invoked by alias); 16 Dec 2014 16:10:21 -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 24412 invoked by uid 48); 16 Dec 2014 16:10:17 -0000
From: "izamyatin at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/64286] Redundant extend removal ignores vector element type
Date: Tue, 16 Dec 2014 16:10: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: 4.9.0
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: major
X-Bugzilla-Who: izamyatin 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:
Message-ID: <bug-64286-4-kVBHNkipqE@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64286-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64286-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/msg01899.txt.bz2
Content-length: 732

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd286

--- Comment #1 from Igor Zamyatin <izamyatin at gmail dot com> ---
Perhaps something like below to restrict ree for such cases?

diff --git a/gcc/ree.c b/gcc/ree.c
index 3376901..92370ea 100644
--- a/gcc/ree.c
+++ b/gcc/ree.c
@@ -1004,6 +1004,11 @@ add_removable_extension (const_rtx expr, rtx_insn *insn,
       struct df_link *defs, *def;
       ext_cand *cand;

+      if (!SCALAR_INT_MODE_P (GET_MODE (dest))
+      && (GET_MODE_UNIT_PRECISION (mode) !+          GET_MODE_UNIT_PRECISION (GET_MODE (XEXP (src, 0)))))
+    return;
+
       /* First, make sure we can get all the reaching definitions.  */
       defs = get_defs (insn, XEXP (src, 0), NULL);
       if (!defs)


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-10 13:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-16 16:06 [Bug c++/64332] New: gcc/g++ handles system_header differently a3at.mail at gmail dot com
2014-12-16 16:46 ` [Bug c++/64332] " pinskia at gcc dot gnu.org
2014-12-16 17:00 ` a3at.mail at gmail dot com
2014-12-16 17:42 ` [Bug c/64332] wrong location for Wattributes warning manu at gcc dot gnu.org
2022-01-10 13:04 ` redi at gcc dot gnu.org

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).