public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/56977] New: gcc -Og incorrectly warns about 'constant zero length parameter'
@ 2013-04-16 11:09 baugesta at cisco dot com
  2013-06-13 19:23 ` [Bug c/56977] " harald at gigawatt dot nl
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: baugesta at cisco dot com @ 2013-04-16 11:09 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56977
           Summary: gcc -Og incorrectly warns about 'constant zero length
                    parameter'
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: baugesta@cisco.com


Created attachment 29881
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29881
Preprocessed version of snippet in the Description field.

Compiling this tiny snippet with the command 'gcc -v -Og' produces an incorrect
warning about zero length parameter:

#include <string.h>

void foo(char *buf, size_t w, size_t h)
{
    size_t n = w * h;
    if (n > 0)
        memset(buf, 123, n);
}

The warning looks like this:
/usr/include/bits/string3.h:81:30: warning: call to ‘__warn_memset_zero_len’
declared with attribute warning: memset used with constant zero length
parameter; this could be due to transposed parameters [enabled by default]
       __warn_memset_zero_len ();


Output from gcc -v:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.0/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.8.0/work/gcc-4.8.0/configure
--prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.0
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.0/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.0
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.0/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.0/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.0/include/g++-v4
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
--disable-fixed-point --without-ppl --without-cloog --enable-lto --enable-nls
--without-included-gettext --with-system-zlib --enable-obsolete
--disable-werror --enable-secureplt --enable-multilib
--with-multilib-list=m32,m64 --enable-libmudflap --disable-libssp
--enable-libgomp
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.8.0/python
--enable-checking=release --disable-libgcj --enable-libstdcxx-time
--disable-libquadmath --enable-languages=c,c++,objc --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
--enable-targets=all --with-bugurl=http://bugs.gentoo.org/
--with-pkgversion='Gentoo 4.8.0 p1.1, pie-0.5.5'
Thread model: posix
gcc version 4.8.0 (Gentoo 4.8.0 p1.1, pie-0.5.5)
>From gcc-bugs-return-420378-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Apr 16 11:10:10 2013
Return-Path: <gcc-bugs-return-420378-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 18327 invoked by alias); 16 Apr 2013 11:10:10 -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 18280 invoked by uid 48); 16 Apr 2013 11:10:07 -0000
From: "krebbel at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/56978] New: memset-chk.c failure since r197671
Date: Tue, 16 Apr 2013 11:10:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: krebbel at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields:
Message-ID: <bug-56978-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-SW-Source: 2013-04/txt/msg01523.txt.bz2
Content-length: 3565


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

             Bug #: 56978
           Summary: memset-chk.c failure since r197671
    Classification: Unclassified
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: krebbel@gcc.gnu.org


/home/andreas/clean/gcc-head-build/gcc/xgcc
-B/home/andreas/clean/gcc-head-build/gcc/
/home/andreas/clean/gcc-head/gcc/testsuite/gcc.c-torture/execute/builtins/memset-chk.c
/home/andreas/clean/gcc-head/gcc/testsuite/gcc.c-torture/execute/builtins/memset-chk-lib.c
/home/andreas/clean/gcc-head/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c
-fno-diagnostics-show-caret -w -O3 -fomit-frame-pointer -funroll-loops
-fno-tree-loop-distribute-patterns -lm -o
/home/andreas/clean/gcc-head-build/gcc/testsuite/gcc5/memset-chk.x

/home/andreas/clean/gcc-head/gcc/testsuite/gcc.c-torture/execute/builtins/memset-chk.c:
In function ‘test5’:
/home/andreas/clean/gcc-head/gcc/testsuite/gcc.c-torture/execute/builtins/memset-chk.c:552:1:
internal compiler error: in emit_move_insn_1, at expr.c:3428
0x802f712b emit_move_insn_1(rtx_def*, rtx_def*)
        /home/andreas/clean/gcc-head/gcc/expr.c:3428
0x802f71c5 emit_move_insn(rtx_def*, rtx_def*)
        /home/andreas/clean/gcc-head/gcc/expr.c:3526
0x802d68bb force_reg
        /home/andreas/clean/gcc-head/gcc/explow.c:676
0x802f8053 convert_move(rtx_def*, rtx_def*, int)
        /home/andreas/clean/gcc-head/gcc/expr.c:590
0x802f87b9 convert_modes(machine_mode, machine_mode, rtx_def*, int)
        /home/andreas/clean/gcc-head/gcc/expr.c:781
0x804bd919 expand_binop_directly
        /home/andreas/clean/gcc-head/gcc/optabs.c:1427
0x804bb57f expand_binop(machine_mode, optab_tag, rtx_def*, rtx_def*, rtx_def*,
int, optab_methods)
        /home/andreas/clean/gcc-head/gcc/optabs.c:1543
0x804bd70d expand_simple_binop(machine_mode, rtx_code, rtx_def*, rtx_def*,
rtx_def*, int, optab_methods)
        /home/andreas/clean/gcc-head/gcc/optabs.c:1291
0x802fb645 force_operand(rtx_def*, rtx_def*)
        /home/andreas/clean/gcc-head/gcc/expr.c:7054
0x8094d3c3 doloop_modify
        /home/andreas/clean/gcc-head/gcc/loop-doloop.c:480
0x8094d3c3 doloop_optimize
        /home/andreas/clean/gcc-head/gcc/loop-doloop.c:750
0x8094d3c3 doloop_optimize_loops()
        /home/andreas/clean/gcc-head/gcc/loop-doloop.c:764
0x804549d7 rtl_doloop
        /home/andreas/clean/gcc-head/gcc/loop-init.c:543
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Reghunt indicates that the error has been introduced with:

2013-04-10  Richard Biener  <rguenther@suse.de>

    * passes.c (execute_todo): Do not call ggc_collect conditional here.
    (execute_one_ipa_transform_pass): But unconditionally here.
    (execute_one_pass): And here.
    (init_optimization_passes): Remove reload pass.
    * tree-pass.h (TODO_ggc_collect): Remove.
    (pass_reload): Likewise.
    * ira.c (do_reload): Merge into ...
    (ira): ... this.
    (rest_of_handle_reload): Remove.
    (pass_reload): Likewise.
    * config/i386/i386.c (ix86_option_override): Refer to ira instead
    of reload for vzeroupper pass placement.
    * <everywhere>: Remove TODO_ggc_collect from todo_flags_start
    and todo_flags_finish of all passes.

    * g++.dg/pr55604.C: Use -fdump-rtl-ira.
>From gcc-bugs-return-420379-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Apr 16 11:13:37 2013
Return-Path: <gcc-bugs-return-420379-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 20204 invoked by alias); 16 Apr 2013 11:13:37 -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 20165 invoked by uid 48); 16 Apr 2013 11:13:34 -0000
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/56969] [4.9 Regression] ISO_C_BINDING regression with current trunk
Date: Tue, 16 Apr 2013 11:13:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Keywords: rejects-valid
X-Bugzilla-Severity: normal
X-Bugzilla-Who: burnus 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: 4.9.0
X-Bugzilla-Changed-Fields:
Message-ID: <bug-56969-4-bD0ucvZTN1@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-56969-4@http.gcc.gnu.org/bugzilla/>
References: <bug-56969-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
MIME-Version: 1.0
X-SW-Source: 2013-04/txt/msg01524.txt.bz2
Content-length: 442


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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-04-16 11:13:34 UTC ---
Draft patch:

--- a/gcc/fortran/intrinsic.c
+++ b/gcc/fortran/intrinsic.c
@@ -4238,3 +4238,4 @@ got_specific:
   expr->value.function.isym = specific;
-  gfc_intrinsic_symbol (expr->symtree->n.sym);
+  if (!expr->symtree->n.sym->module)
+    gfc_intrinsic_symbol (expr->symtree->n.sym);


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

* [Bug c/56977] gcc -Og incorrectly warns about 'constant zero length parameter'
  2013-04-16 11:09 [Bug c/56977] New: gcc -Og incorrectly warns about 'constant zero length parameter' baugesta at cisco dot com
@ 2013-06-13 19:23 ` harald at gigawatt dot nl
  2013-06-15  9:59 ` [Bug middle-end/56977] " harald at gigawatt dot nl
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: harald at gigawatt dot nl @ 2013-06-13 19:23 UTC (permalink / raw)
  To: gcc-bugs

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


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

* [Bug middle-end/56977] gcc -Og incorrectly warns about 'constant zero length parameter'
  2013-04-16 11:09 [Bug c/56977] New: gcc -Og incorrectly warns about 'constant zero length parameter' baugesta at cisco dot com
  2013-06-13 19:23 ` [Bug c/56977] " harald at gigawatt dot nl
@ 2013-06-15  9:59 ` harald at gigawatt dot nl
  2013-06-16 21:15 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: harald at gigawatt dot nl @ 2013-06-15  9:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Harald van Dijk <harald at gigawatt dot nl> ---
Inlining isn't relevant:

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

void f (int i) {
  if (__builtin_constant_p (i)) {
    error ();
  }
}

fails the same way. But it doesn't fail with all uses of __builtin_constant_p:

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

void f () {
  int g ();
  if (!__builtin_constant_p (1)) {
    error ();
  }
  if (__builtin_constant_p (g ())) {
    error ();
  }
}

compiles without any problems.


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

* [Bug middle-end/56977] gcc -Og incorrectly warns about 'constant zero length parameter'
  2013-04-16 11:09 [Bug c/56977] New: gcc -Og incorrectly warns about 'constant zero length parameter' baugesta at cisco dot com
  2013-06-13 19:23 ` [Bug c/56977] " harald at gigawatt dot nl
  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
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-06-16 21:15 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |naruse at airemix dot jp

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 57621 has been marked as a duplicate of this bug. ***


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

* [Bug middle-end/56977] gcc -Og incorrectly warns about 'constant zero length parameter'
  2013-04-16 11:09 [Bug c/56977] New: gcc -Og incorrectly warns about 'constant zero length parameter' baugesta at cisco dot com
                   ` (2 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-06-17 10:09 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-06-17
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
   Target Milestone|---                         |4.8.2
     Ever confirmed|0                           |1

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Interesting because we do fold the call and end up with

f (int i)
{
  int _3;

  <bb 2>:
  _3 = 0;
  if (_3 != 0)
    goto <bb 3>;
  else
    goto <bb 4>;

  <bb 3>:
  error ();

  <bb 4>:
  return;

where the zero does not end up being propagated into the conditional
at any point further down into the compilation ... (TER is disabled
which is what usually saves us here).

A simple solution is to exchange pass_fold_builtins and pass_dce in
pass_all_optimizations_g.


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

* [Bug middle-end/56977] gcc -Og incorrectly warns about 'constant zero length parameter'
  2013-04-16 11:09 [Bug c/56977] New: gcc -Og incorrectly warns about 'constant zero length parameter' baugesta at cisco dot com
                   ` (3 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-06-25  8:22 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.9.0

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Tue Jun 25 08:21:31 2013
New Revision: 200391

URL: http://gcc.gnu.org/viewcvs?rev=200391&root=gcc&view=rev
Log:
2013-06-25  Richard Biener  <rguenther@suse.de>

    PR middle-end/56977
    * passes.c (init_optimization_passes): Move pass_fold_builtins
    and pass_dce earlier with -Og.

    * gcc.dg/pr56977.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/pr56977.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/passes.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug middle-end/56977] gcc -Og incorrectly warns about 'constant zero length parameter'
  2013-04-16 11:09 [Bug c/56977] New: gcc -Og incorrectly warns about 'constant zero length parameter' baugesta at cisco dot com
                   ` (4 preceding siblings ...)
  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
  7 siblings, 0 replies; 9+ messages in thread
From: harald at gigawatt dot nl @ 2013-06-27 16:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Harald van Dijk <harald at gigawatt dot nl> ---
FWIW, I've done some more testing with that on top of 4.8.1 and haven't been
able to find anything that breaks that wasn't already broken without it. Nice,
thanks.


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

* [Bug middle-end/56977] gcc -Og incorrectly warns about 'constant zero length parameter'
  2013-04-16 11:09 [Bug c/56977] New: gcc -Og incorrectly warns about 'constant zero length parameter' baugesta at cisco dot com
                   ` (5 preceding siblings ...)
  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
  7 siblings, 0 replies; 9+ messages in thread
From: bastiaan at bjacques dot org @ 2013-07-07 23:05 UTC (permalink / raw)
  To: gcc-bugs

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

Bastiaan Jacques <bastiaan at bjacques dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bastiaan at bjacques dot org

--- Comment #7 from Bastiaan Jacques <bastiaan at bjacques dot org> ---
The following program fd.cc:

#include <sys/select.h>

int some_socket = 0;

void
foo()
{
    fd_set fdset;
    struct timeval tval;

    FD_ZERO(&fdset);
    FD_SET(some_socket, &fdset);
}

When compiled with:

g++ -c -o fd.o fd.cc  -D_FORTIFY_SOURCE=2  -Og

Generates the following warning:

fd.cc:12:219: warning: call to ‘__fdelt_warn’ declared with attribute warning:
bit outside of fd_set selected [enabled by default]
     FD_SET(some_socket, &fdset);

I think this might be another instance of this bug, because it goes away when
switching to -O2 (but I don't have a 4.8 branch handy to test whether the fix
also resolved this case).
>From gcc-bugs-return-425890-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Jul 07 23:15:56 2013
Return-Path: <gcc-bugs-return-425890-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 29944 invoked by alias); 7 Jul 2013 23:15: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 29912 invoked by uid 48); 7 Jul 2013 23:15:52 -0000
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/57842] for statement not terminating properly
Date: Sun, 07 Jul 2013 23:15: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.6.3
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: redi at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
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-57842-4-Atq0wIpbrQ@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57842-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57842-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-07/txt/msg00397.txt.bz2
Content-length: 255

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
http://www.codinghorror.com/blog/2008/03/the-first-rule-of-programming-its-always-your-fault.html

select isn't broken, neither is 'for'


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

* [Bug middle-end/56977] gcc -Og incorrectly warns about 'constant zero length parameter'
  2013-04-16 11:09 [Bug c/56977] New: gcc -Og incorrectly warns about 'constant zero length parameter' baugesta at cisco dot com
                   ` (6 preceding siblings ...)
  2013-07-07 23:05 ` bastiaan at bjacques dot org
@ 2013-08-28  8:30 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-08-28  8:30 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to work|                            |4.8.2
         Resolution|---                         |FIXED
      Known to fail|                            |4.8.1

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Wed Aug 28 08:29:48 2013
New Revision: 202046

URL: http://gcc.gnu.org/viewcvs?rev=202046&root=gcc&view=rev
Log:
2013-08-28  Richard Biener  <rguenther@suse.de>

    Backport from mainline
    2013-06-24  Richard Biener  <rguenther@suse.de>

    PR middle-end/56977
    * passes.c (init_optimization_passes): Move pass_fold_builtins
    and pass_dce earlier with -Og.

    * gcc.dg/pr56977.c: New testcase.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/pr56977.c
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/passes.c
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2013-08-28  8:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-16 11:09 [Bug c/56977] New: gcc -Og incorrectly warns about 'constant zero length parameter' baugesta at cisco dot com
2013-06-13 19:23 ` [Bug c/56977] " harald at gigawatt dot nl
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

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