public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "harald at gigawatt dot nl" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/56977] gcc -Og incorrectly warns about 'constant zero length parameter'
Date: Thu, 13 Jun 2013 19:23:00 -0000	[thread overview]
Message-ID: <bug-56977-4-ZXuQyCKvqF@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-56977-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56977

Harald van Dijk <harald at gigawatt dot nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |harald at gigawatt dot nl

--- Comment #1 from Harald van Dijk <harald at gigawatt dot nl> ---
This is a bigger problem with glibc's open() implementation, where correct use
does not just lead to a warning, but to a compile-time error. Self-contained
test:

__attribute__((__error__("error"))) void error ();

void f (int);

extern inline __attribute__((__always_inline__)) void f (int i) {
  if (__builtin_constant_p (i)) {
    error ();
  }
}

void g(int j) {
  f (j);
}

Compiling with -Og leads to:

$ gcc -Og -c test.c
In function ‘f’,
    inlined from ‘g’ at test.c:12:5:
test.c:7:11: error: call to ‘error’ declared with attribute error: error
     error ();
           ^
$ gcc --version
gcc (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1)
Copyright (C) 2013 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.

The if block, including the call to error(), gets removed at all optimization
levels (even -O0) other than -Og.
>From gcc-bugs-return-424319-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jun 13 19:43:56 2013
Return-Path: <gcc-bugs-return-424319-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 26215 invoked by alias); 13 Jun 2013 19:43:55 -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 26184 invoked by uid 48); 13 Jun 2013 19:43:52 -0000
From: "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/57509] Segmentation fault when using __builtin_shuffle in templated class.
Date: Thu, 13 Jun 2013 19: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.8.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: glisse at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: glisse at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status assigned_to target_milestone
Message-ID: <bug-57509-4-jGecIZOJe5@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57509-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57509-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: 2013-06/txt/msg00698.txt.bz2
Content-length: 564

http://gcc.gnu.org/bugzilla/show_bug.cgi?idW509

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |glisse at gcc dot gnu.org
   Target Milestone|---                         |4.9.0

--- Comment #8 from Marc Glisse <glisse at gcc dot gnu.org> ---
Patch posted:
http://gcc.gnu.org/ml/gcc-patches/2013-06/msg00470.html


  reply	other threads:[~2013-06-13 19:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-16 11:09 [Bug c/56977] New: " baugesta at cisco dot com
2013-06-13 19:23 ` harald at gigawatt dot nl [this message]
2013-06-15  9:59 ` [Bug middle-end/56977] " harald at gigawatt dot nl
2013-06-16 21:15 ` pinskia at gcc dot gnu.org
2013-06-17 10:09 ` rguenth at gcc dot gnu.org
2013-06-25  8:22 ` rguenth at gcc dot gnu.org
2013-06-27 16:40 ` harald at gigawatt dot nl
2013-07-07 23:05 ` bastiaan at bjacques dot org
2013-08-28  8:30 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-56977-4-ZXuQyCKvqF@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).