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

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