public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/38454] New: [4.4 Regression] memcpy folding breaks -D_FORTIFY_SOURCE=2 protection
@ 2008-12-09 15:43 jakub at gcc dot gnu dot org
2008-12-09 15:46 ` [Bug middle-end/38454] " jakub at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-12-09 15:43 UTC (permalink / raw)
To: gcc-bugs
/* { dg-do compile } */
/* { dg-options "-O2" } */
typedef __SIZE_TYPE__ size_t;
extern inline __attribute__((gnu_inline, always_inline, artificial)) void *
memcpy (void *__restrict dest, const void *__restrict src, size_t len)
{
return __builtin___memcpy_chk (dest, /* { dg-warning "will always overflow
destination buffer" } */
src, len, __builtin_object_size (dest, 0));
}
struct S { char buf[10]; } s;
void
foo (void)
{
char buf[12];
char *p = buf + 4;
struct S *q = (struct S *) p;
memcpy (q, &s, sizeof (s));
}
/* { dg-final { scan-assembler "__memcpy_chk" } } */
FAILs since I've added new memcpy folding. The memcpy is folded before it is
inlined and so it isn't warned on, nor checked at runtime. Testing a patch
that will help this as well as e.g. the memset swapped arguments warning.
--
Summary: [4.4 Regression] memcpy folding breaks -
D_FORTIFY_SOURCE=2 protection
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: jakub at gcc dot gnu dot org
ReportedBy: jakub at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38454
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/38454] [4.4 Regression] memcpy folding breaks -D_FORTIFY_SOURCE=2 protection
2008-12-09 15:43 [Bug middle-end/38454] New: [4.4 Regression] memcpy folding breaks -D_FORTIFY_SOURCE=2 protection jakub at gcc dot gnu dot org
@ 2008-12-09 15:46 ` jakub at gcc dot gnu dot org
2008-12-09 19:39 ` mmitchel at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-12-09 15:46 UTC (permalink / raw)
To: gcc-bugs
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2008-12-09 15:42:33
date| |
Target Milestone|--- |4.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38454
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/38454] [4.4 Regression] memcpy folding breaks -D_FORTIFY_SOURCE=2 protection
2008-12-09 15:43 [Bug middle-end/38454] New: [4.4 Regression] memcpy folding breaks -D_FORTIFY_SOURCE=2 protection jakub at gcc dot gnu dot org
2008-12-09 15:46 ` [Bug middle-end/38454] " jakub at gcc dot gnu dot org
@ 2008-12-09 19:39 ` mmitchel at gcc dot gnu dot org
2008-12-09 23:04 ` jakub at gcc dot gnu dot org
2008-12-09 23:24 ` jakub at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2008-12-09 19:39 UTC (permalink / raw)
To: gcc-bugs
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38454
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/38454] [4.4 Regression] memcpy folding breaks -D_FORTIFY_SOURCE=2 protection
2008-12-09 15:43 [Bug middle-end/38454] New: [4.4 Regression] memcpy folding breaks -D_FORTIFY_SOURCE=2 protection jakub at gcc dot gnu dot org
2008-12-09 15:46 ` [Bug middle-end/38454] " jakub at gcc dot gnu dot org
2008-12-09 19:39 ` mmitchel at gcc dot gnu dot org
@ 2008-12-09 23:04 ` jakub at gcc dot gnu dot org
2008-12-09 23:24 ` jakub at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-12-09 23:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jakub at gcc dot gnu dot org 2008-12-09 23:03 -------
Subject: Bug 38454
Author: jakub
Date: Tue Dec 9 23:01:15 2008
New Revision: 142617
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142617
Log:
PR middle-end/38454
* function.h (struct function): Add always_inline_functions_inlined.
* ipa-inline.c (cgraph_early_inlining): Set it to true.
* tree-optimize.c (execute_fixup_cfg): Likewise.
* builtins.c (avoid_folding_inline_builtin): New function.
(fold_call_expr): Don't optimize always_inline builtins before
inlining.
(fold_call_stmt): Likewise.
(fold_builtin_call_array): Likewise. Don't call
fold_builtin_varargs for BUILT_IN_MD builtins.
* gcc.dg/memset-1.c: New test.
* gcc.dg/memcpy-2.c: New test.
Added:
trunk/gcc/testsuite/gcc.dg/memcpy-2.c
trunk/gcc/testsuite/gcc.dg/memset-1.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/builtins.c
trunk/gcc/function.h
trunk/gcc/ipa-inline.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-optimize.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38454
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/38454] [4.4 Regression] memcpy folding breaks -D_FORTIFY_SOURCE=2 protection
2008-12-09 15:43 [Bug middle-end/38454] New: [4.4 Regression] memcpy folding breaks -D_FORTIFY_SOURCE=2 protection jakub at gcc dot gnu dot org
` (2 preceding siblings ...)
2008-12-09 23:04 ` jakub at gcc dot gnu dot org
@ 2008-12-09 23:24 ` jakub at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-12-09 23:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jakub at gcc dot gnu dot org 2008-12-09 23:13 -------
Fixed.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38454
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-12-09 23:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-09 15:43 [Bug middle-end/38454] New: [4.4 Regression] memcpy folding breaks -D_FORTIFY_SOURCE=2 protection jakub at gcc dot gnu dot org
2008-12-09 15:46 ` [Bug middle-end/38454] " jakub at gcc dot gnu dot org
2008-12-09 19:39 ` mmitchel at gcc dot gnu dot org
2008-12-09 23:04 ` jakub at gcc dot gnu dot org
2008-12-09 23:24 ` jakub at gcc dot gnu dot 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).