This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/49279] [4.5/4.6/4.7 Regression] Optimization incorrectly presuming constant variable inside loop in g++ 4.5 and 4.6 with -O2 and -O3 for x86_64 targets
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 06 Oct 2011 08:09:51 +0000
- Subject: [Bug tree-optimization/49279] [4.5/4.6/4.7 Regression] Optimization incorrectly presuming constant variable inside loop in g++ 4.5 and 4.6 with -O2 and -O3 for x86_64 targets
- Auto-submitted: auto-generated
- References: <bug-49279-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49279
--- Comment #14 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-10-06 08:09:51 UTC ---
(In reply to comment #11)
> Created attachment 25423 [details]
> CAST_RESTRICT removal
>
> Attaching a test patch that just removed CAST_RESTRICT altogether, plus IRC
> discussion that lead to it. The only testsuite regressions are Wobjsize-1.c
> and strlenopt-4gf.c which show an important security related problem - we
> probably shouldn't be folding builtins if DECL_INITIAL (fndecl) != NULL &&
> DECL_DECLARED_INLINE_P (fndecl) && cfun && !cfun->after_inlining,
> because then we happily fold e.g. char buf[2]; strcpy (buf, "abcd"); into
> __builtin_memcpy even when strcpy is always_inline inline wrapper that calls
> __builtin___strcpy_chk and would complain about the buffer overflow resp. add
> runtime checking.
The patch looks ok to me once we solved the folding issue (we probably have
to backport that as well then).