This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/36602] New: memset should be optimized into an empty CONSTRUCTOR
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Jun 2008 21:06:12 -0000
- Subject: [Bug tree-optimization/36602] New: memset should be optimized into an empty CONSTRUCTOR
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I noticed this while looking into tree-ssa-sccvn.c sources (though I doubt it
helps in general really). But anyways we should optimize the following code
into just a "return 0;":
struct f
{
int t, k;
int g[1024];
};
int g(void)
{
struct f a;
__builtin_memset(&a, 0, sizeof(a));
return a.t;
}
-- CUT ---
You can see that with the above code we get a zeroing for the struct still.
--
Summary: memset should be optimized into an empty CONSTRUCTOR
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: missed-optimization, TREE
Severity: enhancement
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36602