public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/59125] [4.8/4.9 Regression] gcc triggers wrong strncpy_chk Date: Fri, 15 Nov 2013 13:37:00 -0000 [thread overview] Message-ID: <bug-59125-4-5rzePXn0qM@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-59125-4@http.gcc.gnu.org/bugzilla/> 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).
next prev parent reply other threads:[~2013-11-15 13:37 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-11-14 1:24 [Bug c/59125] New: [4.8 regression] " 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 [this message] 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
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-59125-4-5rzePXn0qM@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: linkBe 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).