public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/59125] New: [4.8 regression] gcc triggers wrong strncpy_chk
@ 2013-11-14  1:24 jengelh at inai dot de
  2013-11-14  9:34 ` [Bug middle-end/59125] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: jengelh at inai dot de @ 2013-11-14  1:24 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 8328 bytes --]

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

            Bug ID: 59125
           Summary: [4.8 regression] gcc triggers wrong strncpy_chk
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jengelh at inai dot de

Given this compiler version/variant:

> gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/4.8/lto-wrapper
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64
--enable-languages=c,c++,objc,fortran,obj-c++,java,ada
--enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.8
--enable-ssp --disable-libssp --disable-plugin
--with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux'
--disable-libgcj --disable-libmudflap --with-slibdir=/lib64 --with-system-zlib
--enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch
--enable-version-specific-runtime-libs --enable-linker-build-id
--enable-linux-futex --program-suffix=-4.8 --without-system-libunwind
--with-arch-32=i586 --with-tune=generic --build=x86_64-suse-linux
--host=x86_64-suse-linux
Thread model: posix
gcc version 4.8.2 20131016 [gcc-4_8-branch revision 203692] (SUSE Linux) 

and this source:

#include <string.h>
union u {
 struct {
  char vi[8];
  char pi[16];
 };
 char all[8+16+4];
};
void f(union u *u)
{
 char vi[8+1];
 char pi[16+1];
 strncpy(vi, u->vi, sizeof(u->vi));
 strncpy(pi, u->pi, sizeof(u->pi));
 strncpy(u->all, "AbcdefghAbcdefghijklmnopAbcd", sizeof(u->all));
}

I observe:

$ gcc-4.8 -O2 -D_FORTIFY_SOURCE=2 -c test.c
In file included from /usr/include/string.h:638:0,
                 from sci.c:1:
In function ‘strncpy’,
    inlined from ‘f’ at sci.c:15:9:
/usr/include/bits/string3.h:120:3: warning: call to __builtin___strncpy_chk
will always overflow destination buffer [enabled by default]
   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
   ^
$ gcc-4.7 -O2 -D_FORTIFY_SOURCE=2 -c sci.c
$ clang -O2 -D_FORTIFY_SOURCE=2 -c sci.c

I would have expected:

gcc-4.8 to do as gcc-4.7 did and remain silent. I cannot see anything wrong
with the strncpy lines…
>From gcc-bugs-return-434540-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Nov 14 01:44:08 2013
Return-Path: <gcc-bugs-return-434540-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 26646 invoked by alias); 14 Nov 2013 01:44:07 -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 26625 invoked by uid 48); 14 Nov 2013 01:44:04 -0000
From: "adam at wozniakconsulting dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/59126] New: internal compiler error: Segmentation fault
Date: Thu, 14 Nov 2013 01:44:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
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: adam at wozniakconsulting 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created
Message-ID: <bug-59126-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-11/txt/msg01317.txt.bz2
Content-length: 4056

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

            Bug ID: 59126
           Summary: internal compiler error: Segmentation fault
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: adam at wozniakconsulting dot com

Created attachment 31214
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id1214&actioníit
preprocessed source

$ lsb_release -a
LSB Version:
core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch:cxx-3.0-amd64:cxx-3.0-noarch:cxx-3.1-amd64:cxx-3.1-noarch:cxx-3.2-amd64:cxx-3.2-noarch:cxx-4.0-amd64:cxx-4.0-noarch:desktop-3.1-amd64:desktop-3.1-noarch:desktop-3.2-amd64:desktop-3.2-noarch:desktop-4.0-amd64:desktop-4.0-noarch:graphics-2.0-amd64:graphics-2.0-noarch:graphics-3.0-amd64:graphics-3.0-noarch:graphics-3.1-amd64:graphics-3.1-noarch:graphics-3.2-amd64:graphics-3.2-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-3.2-amd64:printing-3.2-noarch:printing-4.0-amd64:printing-4.0-noarch:qt4-3.1-amd64:qt4-3.1-noarch
Distributor ID:    Ubuntu
Description:    Ubuntu 12.04.3 LTS
Release:    12.04
Codename:    precise

$ x86_64-linux-gnu-gcc --version
x86_64-linux-gnu-gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 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.

make[2]: Entering directory
`/home/awozniak/work/firstlook/thermal/toolchain/build/build-mpfr/src'
/bin/sh ../libtool --tagÌ   --mode=compile x86_64-linux-gnu-gcc -std=gnu99
-DTIME_WITH_SYS_TIME=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_LOCALE_H=1
-DHAVE_WCHAR_H=1 -DHAVE_STDARG=1 -DHAVE_SYS_TIME_H=1 -DHAVE_ALLOCA_H=1
-DHAVE_STDINT_H=1 -DHAVE_VA_COPY=1 -DHAVE_SETLOCALE=1 -DHAVE_GETTIMEOFDAY=1
-DHAVE_LONG_LONG=1 -DHAVE_INTMAX_T=1 -DMPFR_HAVE_INTMAX_MAX=1
-DMPFR_HAVE_FESETROUND=1 -DHAVE_DENORMS=1 -DHAVE_ROUND=1 -DHAVE_TRUNC=1
-DHAVE_FLOOR=1 -DHAVE_CEIL=1 -DHAVE_NEARBYINT=1
-DHAVE_LDOUBLE_IEEE_EXT_LITTLE=1 -DMPFR_USE_THREAD_SAFE=1
-DHAVE_CLOCK_GETTIME=1 -DLT_OBJDIR=\".libs/\" -DHAVE_ATTRIBUTE_MODE=1
-DHAVE___GMPN_ROOTREM=1 -DHAVE___GMPN_SBPI1_DIVAPPR_Q=1 -I.
-I../../mpfr-3.1.2/src     -Wall -Wmissing-prototypes -Wpointer-arith -Wall -g
-O3 -MT set_f.lo -MD -MP -MF .deps/set_f.Tpo -c -o set_f.lo
../../mpfr-3.1.2/src/set_f.c
libtool: compile:  x86_64-linux-gnu-gcc -std=gnu99 -DTIME_WITH_SYS_TIME=1
-DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_LOCALE_H=1 -DHAVE_WCHAR_H=1
-DHAVE_STDARG=1 -DHAVE_SYS_TIME_H=1 -DHAVE_ALLOCA_H=1 -DHAVE_STDINT_H=1
-DHAVE_VA_COPY=1 -DHAVE_SETLOCALE=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_LONG_LONG=1
-DHAVE_INTMAX_T=1 -DMPFR_HAVE_INTMAX_MAX=1 -DMPFR_HAVE_FESETROUND=1
-DHAVE_DENORMS=1 -DHAVE_ROUND=1 -DHAVE_TRUNC=1 -DHAVE_FLOOR=1 -DHAVE_CEIL=1
-DHAVE_NEARBYINT=1 -DHAVE_LDOUBLE_IEEE_EXT_LITTLE=1 -DMPFR_USE_THREAD_SAFE=1
-DHAVE_CLOCK_GETTIME=1 -DLT_OBJDIR=\".libs/\" -DHAVE_ATTRIBUTE_MODE=1
-DHAVE___GMPN_ROOTREM=1 -DHAVE___GMPN_SBPI1_DIVAPPR_Q=1 -I.
-I../../mpfr-3.1.2/src -Wall -Wmissing-prototypes -Wpointer-arith -Wall -g -O3
-MT set_f.lo -MD -MP -MF .deps/set_f.Tpo -c ../../mpfr-3.1.2/src/set_f.c  -fPIC
-DPIC -o .libs/set_f.o
../../mpfr-3.1.2/src/set_f.c: In function 'mpfr_set_f':
../../mpfr-3.1.2/src/set_f.c:27:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccrVWU7l.out file, please attach this to
your bugreport.
make[2]: *** [set_f.lo] Error 1
make[2]: Leaving directory
`/home/awozniak/work/firstlook/thermal/toolchain/build/build-mpfr/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory
`/home/awozniak/work/firstlook/thermal/toolchain/build/build-mpfr/src'
make: *** [all-recursive] Error 1


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

* [Bug middle-end/59125] [4.8/4.9 Regression] gcc triggers wrong strncpy_chk
  2013-11-14  1:24 [Bug c/59125] New: [4.8 regression] gcc triggers wrong strncpy_chk jengelh at inai dot de
@ 2013-11-14  9:34 ` rguenth at gcc dot gnu.org
  2013-11-14  9:42 ` rguenth at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-14  9:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-11-14
          Component|c                           |middle-end
   Target Milestone|---                         |4.8.3
            Summary|[4.8 regression] gcc        |[4.8/4.9 Regression] gcc
                   |triggers wrong strncpy_chk  |triggers wrong strncpy_chk
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  I think we have a similar dup for this that shows the opposite
(missed check).

We CSE the addresses &u.vi[0] and &u.all[0] resulting in

  <bb 2>:
  _2 = &u_1(D)->D.2172.vi;
  __builtin_strncpy (&vi, _2, 8);
  _5 = &u_1(D)->D.2172.pi;
  __builtin_strncpy (&pi, _5, 16);
  _10 = __builtin_object_size (_2, 1);
  __builtin___strncpy_chk (_2, "AbcdefghAbcdefghijklmnopAbcd", 28, _10);

and thus object-size computation going havoc.  The objsz pass reads
too much into the structure of addresses.

We can mitigate this somewhat by folding object sizes early more aggressively
but in this case, when we don't want to fold to 'unknown' too early (like
for this case, where u->all has unknown size as trailing array), it does not
help (we want to wait for an inlining eventually turing 'u' into the address
of a real object to constrain u->all further).

There are opposite desires at work here - the desires to optimize the
program to get more precise 'objects' and the desire to optimize not too much
to confuse the object size computation.


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

* [Bug middle-end/59125] [4.8/4.9 Regression] gcc triggers wrong strncpy_chk
  2013-11-14  1:24 [Bug c/59125] New: [4.8 regression] gcc triggers wrong strncpy_chk jengelh at inai dot de
  2013-11-14  9:34 ` [Bug middle-end/59125] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
@ 2013-11-14  9:42 ` rguenth at gcc dot gnu.org
  2013-11-14 12:59 ` rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-14  9:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
We already re-fold whenever we fold the object-size stmt via fold_stmt looking
up the def of the address - inlining for example triggers this.  We'd later
pick up more opportunities if we'd enhance forwprop for this for example with:

@@ -1002,6 +1003,22 @@ forward_propagate_addr_expr (tree name,
       bool result;
       tree use_rhs;

+      /* If the use is a __builtin_object_size call then try folding it.  */
+      if (gimple_call_builtin_p (use_stmt, BUILT_IN_OBJECT_SIZE))
+       {
+         tree res = fold_builtin_object_size (rhs,
+                                              gimple_call_arg (use_stmt, 1));
+         if (res
+             && TREE_CODE (res) == INTEGER_CST
+             && !integer_all_onesp (res))
+           {
+             gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt);
+             update_call_from_tree (&gsi, res);
+             update_stmt (gsi_stmt (gsi));
+             continue;
+           }
+       }
+
       /* If the use is not in a simple assignment statement, then
         there is nothing we can do.  */
       if (gimple_code (use_stmt) != GIMPLE_ASSIGN)

but it does not help this testcase as explained, but it helps the following
one:

#include <string.h>
struct s {
    union u {
        struct {
            char vi[8];
            char pi[16];
        };
        char all[8+16+4];
    } u;
    int x;
};
void f(struct s *s)
{
  char vi[8+1];
  char pi[16+1];
  strncpy(vi, s->u.vi, sizeof(s->u.vi));
  strncpy(s->u.all, "AbcdefghAbcdefghijklmnopAbcd", sizeof(s->u.all));
}


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

* [Bug middle-end/59125] [4.8/4.9 Regression] gcc triggers wrong strncpy_chk
  2013-11-14  1:24 [Bug c/59125] New: [4.8 regression] gcc triggers wrong strncpy_chk jengelh at inai dot de
  2013-11-14  9:34 ` [Bug middle-end/59125] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
  2013-11-14  9:42 ` rguenth at gcc dot gnu.org
@ 2013-11-14 12:59 ` rguenth at gcc dot gnu.org
  2013-11-15 13:37 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-14 12:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
It doesn't work that easily.  But we could "refine" a folding result without
actually doing the folding by adding an additional argument to the builtin
which serves as a (sofar) known maximum/minimum value.


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

* [Bug middle-end/59125] [4.8/4.9 Regression] gcc triggers wrong strncpy_chk
  2013-11-14  1:24 [Bug c/59125] New: [4.8 regression] gcc triggers wrong strncpy_chk jengelh at inai dot de
                   ` (2 preceding siblings ...)
  2013-11-14 12:59 ` rguenth at gcc dot gnu.org
@ 2013-11-15 13:37 ` rguenth at gcc dot gnu.org
  2013-11-15 13:39 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-15 13:37 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Hack to disable the CSE for the relevant cases (which I think are
not-offsetting COMPONENT_REFs):

Index: gcc/tree-ssa-sccvn.c
===================================================================
--- gcc/tree-ssa-sccvn.c        (revision 204787)
+++ gcc/tree-ssa-sccvn.c        (working copy)
@@ -759,7 +759,7 @@ copy_reference_ops_from_ref (tree ref, v
     }

   /* For non-calls, store the information that makes up the address.  */
-
+  tree orig = ref;
   while (ref)
     {
       vn_reference_op_s temp;
@@ -809,7 +809,9 @@ copy_reference_ops_from_ref (tree ref, v
                        + tree_to_double_int (bit_offset)
                        .rshift (BITS_PER_UNIT == 8
                                   ? 3 : exact_log2 (BITS_PER_UNIT));
-                   if (off.fits_shwi ())
+                   if (off.fits_shwi ()
+                       && (TREE_CODE (orig) != ADDR_EXPR
+                           || !off.is_zero ()))
                      temp.off = off.low;
                  }
              }

regresses for example

struct s { union { int i; char c[8]; } u; short x; };

char *foo (int b, struct s *p)
{
  int *p1;
  char *p2;
  if (b)
    p1 = &p->u.i;
  p2 = p->u.c;
  return p2 + *p1;
}

which we then only PRE on the RTL level.  Basically we won't treat those
addresses as equal anymore.

Unfortunately the object-size pass runs quite late so even the 2nd FRE
is already finished (and I think first_instance doesn't work for passes
that are also run during early opts).  I'd say cfun->after_inlining
should work but it won't because object-size is so late.

I don't like moving passes around on the branch, but well ... we'd move
it right after the forwprop run after inlining.

I'm going to test that for trunk now (I still hate how objsize works and
how we want it run so late).


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

* [Bug middle-end/59125] [4.8/4.9 Regression] gcc triggers wrong strncpy_chk
  2013-11-14  1:24 [Bug c/59125] New: [4.8 regression] gcc triggers wrong strncpy_chk jengelh at inai dot de
                   ` (3 preceding siblings ...)
  2013-11-15 13:37 ` rguenth at gcc dot gnu.org
@ 2013-11-15 13:39 ` rguenth at gcc dot gnu.org
  2013-11-18 15:25 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-15 13:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Related bug is PR54570.


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

* [Bug middle-end/59125] [4.8/4.9 Regression] gcc triggers wrong strncpy_chk
  2013-11-14  1:24 [Bug c/59125] New: [4.8 regression] gcc triggers wrong strncpy_chk jengelh at inai dot de
                   ` (4 preceding siblings ...)
  2013-11-15 13:39 ` rguenth at gcc dot gnu.org
@ 2013-11-18 15:25 ` rguenth at gcc dot gnu.org
  2013-11-18 15:27 ` [Bug middle-end/59125] [4.8 " rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-18 15:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Mon Nov 18 15:25:05 2013
New Revision: 204966

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

    PR tree-optimization/59125
    PR tree-optimization/54570
    * tree-ssa-sccvn.c (copy_reference_ops_from_ref): When inlining
    is not complete do not treat component-references with offset zero
    but different fields as equal.
    * tree-object-size.c: Include tree-phinodes.h and ssa-iterators.h.
    (compute_object_sizes): Apply TLC.  Propagate the constant
    results into all uses and fold their stmts.
    * passes.def (pass_all_optimizations): Move pass_object_sizes
    after the first pass_forwprop and before pass_fre.

    * gcc.dg/builtin-object-size-8.c: Un-xfail.
    * gcc.dg/builtin-object-size-14.c: New testcase.
    * gcc.dg/strlenopt-14gf.c: Adjust.
    * gcc.dg/strlenopt-1f.c: Likewise.
    * gcc.dg/strlenopt-4gf.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/builtin-object-size-14.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/passes.def
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/builtin-object-size-8.c
    trunk/gcc/testsuite/gcc.dg/strlenopt-14gf.c
    trunk/gcc/testsuite/gcc.dg/strlenopt-1f.c
    trunk/gcc/testsuite/gcc.dg/strlenopt-4gf.c
    trunk/gcc/tree-object-size.c
    trunk/gcc/tree-ssa-sccvn.c


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

* [Bug middle-end/59125] [4.8 Regression] gcc triggers wrong strncpy_chk
  2013-11-14  1:24 [Bug c/59125] New: [4.8 regression] gcc triggers wrong strncpy_chk jengelh at inai dot de
                   ` (5 preceding siblings ...)
  2013-11-18 15:25 ` rguenth at gcc dot gnu.org
@ 2013-11-18 15:27 ` rguenth at gcc dot gnu.org
  2013-12-03  7:49 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-18 15:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.9.0
            Summary|[4.8/4.9 Regression] gcc    |[4.8 Regression] gcc
                   |triggers wrong strncpy_chk  |triggers wrong strncpy_chk
      Known to fail|                            |4.8.2

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.


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

* [Bug middle-end/59125] [4.8 Regression] gcc triggers wrong strncpy_chk
  2013-11-14  1:24 [Bug c/59125] New: [4.8 regression] gcc triggers wrong strncpy_chk jengelh at inai dot de
                   ` (6 preceding siblings ...)
  2013-11-18 15:27 ` [Bug middle-end/59125] [4.8 " rguenth at gcc dot gnu.org
@ 2013-12-03  7:49 ` jakub at gcc dot gnu.org
  2014-01-08 13:49 ` rafal at rawicki dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-12-03  7:49 UTC (permalink / raw)
  To: gcc-bugs

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

Bug 59125 depends on bug 59362, which changed state.

Bug 59362 Summary: [4.9 Regression] Abort in fini_object_sizes
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59362

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED


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

* [Bug middle-end/59125] [4.8 Regression] gcc triggers wrong strncpy_chk
  2013-11-14  1:24 [Bug c/59125] New: [4.8 regression] gcc triggers wrong strncpy_chk jengelh at inai dot de
                   ` (7 preceding siblings ...)
  2013-12-03  7:49 ` jakub at gcc dot gnu.org
@ 2014-01-08 13:49 ` rafal at rawicki dot org
  2014-01-08 14:05 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rafal at rawicki dot org @ 2014-01-08 13:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Rafał Rawicki <rafal at rawicki dot org> ---
I'm hurt by this bug too. Is there a chance of porting the fix to 4.8.3
release?

I see that simple cherry-picking this patch onto 4.8 line is not possible,
because 4.8 and 4.9 branches diverged too much.
>From gcc-bugs-return-439635-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Jan 08 13:49:08 2014
Return-Path: <gcc-bugs-return-439635-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 23866 invoked by alias); 8 Jan 2014 13:49:08 -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 23828 invoked by uid 48); 8 Jan 2014 13:49:04 -0000
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/59387] [4.9 Regression] wrong code (hangs) at -Os on x86_64-linux-gnu
Date: Wed, 08 Jan 2014 13:49:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: rguenth at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P1
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59387-4-ZrRQ3ntqSk@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59387-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59387-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-01/txt/msg00777.txt.bz2
Content-length: 300

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Well, it should pass and check folded_casts to analyze_scalar_evolution_in_loop
and not do anything if that is set to true and the type is
TYPE_OVERFLOW_UNDEFINED (see simple_iv).


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

* [Bug middle-end/59125] [4.8 Regression] gcc triggers wrong strncpy_chk
  2013-11-14  1:24 [Bug c/59125] New: [4.8 regression] gcc triggers wrong strncpy_chk jengelh at inai dot de
                   ` (8 preceding siblings ...)
  2014-01-08 13:49 ` rafal at rawicki dot org
@ 2014-01-08 14:05 ` rguenth at gcc dot gnu.org
  2014-01-09 15:25 ` rguenth at gcc dot gnu.org
  2014-01-09 15:30 ` rguenth at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-01-08 14:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Well, it's on my list - but as you say the backport isn't trivial.  We're still
watching for more possible fallout.


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

* [Bug middle-end/59125] [4.8 Regression] gcc triggers wrong strncpy_chk
  2013-11-14  1:24 [Bug c/59125] New: [4.8 regression] gcc triggers wrong strncpy_chk jengelh at inai dot de
                   ` (9 preceding siblings ...)
  2014-01-08 14:05 ` rguenth at gcc dot gnu.org
@ 2014-01-09 15:25 ` rguenth at gcc dot gnu.org
  2014-01-09 15:30 ` rguenth at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-01-09 15:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Thu Jan  9 15:25:34 2014
New Revision: 206467

URL: http://gcc.gnu.org/viewcvs?rev=206467&root=gcc&view=rev
Log:
2014-01-09  Richard Biener  <rguenther@suse.de>

    Backport from mainline
    2013-11-18  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/59125
    PR tree-optimization/54570
    * tree-ssa-sccvn.c (copy_reference_ops_from_ref): When inlining
    is not complete do not treat component-references with offset zero
    but different fields as equal.
    * tree-object-size.c: Include tree-phinodes.h and ssa-iterators.h.
    (compute_object_sizes): Apply TLC.  Propagate the constant
    results into all uses and fold their stmts.
    * passes.def (pass_all_optimizations): Move pass_object_sizes
    after the first pass_forwprop and before pass_fre.

    * gcc.dg/builtin-object-size-8.c: Un-xfail.
    * gcc.dg/builtin-object-size-14.c: New testcase.
    * gcc.dg/strlenopt-14gf.c: Adjust.
    * gcc.dg/strlenopt-1f.c: Likewise.
    * gcc.dg/strlenopt-4gf.c: Likewise.

    2013-12-03  Jakub Jelinek  <jakub@redhat.com>

    PR tree-optimization/59362
    * tree-object-size.c (object_sizes): Change into array of
    vec<unsigned HOST_WIDE_INT>.
    (compute_builtin_object_size): Check computed bitmap for
    non-NULL instead of object_sizes.  Call safe_grow on object_sizes
    vector if new SSA_NAMEs appeared.
    (init_object_sizes): Check computed bitmap for non-NULL.
    Call safe_grow on object_sizes elements instead of initializing
    it with XNEWVEC.
    (fini_object_sizes): Call release on object_sizes elements, don't
    set it to NULL.

    * gcc.c-torture/compile/pr59362.c: New test.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/gcc.c-torture/compile/pr59362.c
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/builtin-object-size-14.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
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/builtin-object-size-8.c
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/strlenopt-14gf.c
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/strlenopt-1f.c
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/strlenopt-4gf.c
    branches/gcc-4_8-branch/gcc/tree-object-size.c
    branches/gcc-4_8-branch/gcc/tree-ssa-sccvn.c


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

* [Bug middle-end/59125] [4.8 Regression] gcc triggers wrong strncpy_chk
  2013-11-14  1:24 [Bug c/59125] New: [4.8 regression] gcc triggers wrong strncpy_chk jengelh at inai dot de
                   ` (10 preceding siblings ...)
  2014-01-09 15:25 ` rguenth at gcc dot gnu.org
@ 2014-01-09 15:30 ` rguenth at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-01-09 15:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to work|                            |4.8.3
         Resolution|---                         |FIXED

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.


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

end of thread, other threads:[~2014-01-09 15:30 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-14  1:24 [Bug c/59125] New: [4.8 regression] gcc triggers wrong strncpy_chk jengelh at inai dot de
2013-11-14  9:34 ` [Bug middle-end/59125] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
2013-11-14  9:42 ` rguenth at gcc dot gnu.org
2013-11-14 12:59 ` rguenth at gcc dot gnu.org
2013-11-15 13:37 ` rguenth at gcc dot gnu.org
2013-11-15 13:39 ` rguenth at gcc dot gnu.org
2013-11-18 15:25 ` rguenth at gcc dot gnu.org
2013-11-18 15:27 ` [Bug middle-end/59125] [4.8 " rguenth at gcc dot gnu.org
2013-12-03  7:49 ` jakub at gcc dot gnu.org
2014-01-08 13:49 ` rafal at rawicki dot org
2014-01-08 14:05 ` rguenth at gcc dot gnu.org
2014-01-09 15:25 ` rguenth at gcc dot gnu.org
2014-01-09 15: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).