From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5958 invoked by alias); 15 Oct 2013 16:38:31 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 5920 invoked by uid 48); 15 Oct 2013 16:38:28 -0000 From: "glisse at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/57742] memset(malloc(n),0,n) -> calloc(n,1) Date: Tue, 15 Oct 2013 16:38: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: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: glisse at gcc dot gnu.org X-Bugzilla-Status: NEW 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: Message-ID: In-Reply-To: References: 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-10/txt/msg00922.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57742 --- Comment #11 from Marc Glisse --- (In reply to Richard Biener from comment #9) > because of points-to analysis being not context sensitive. Is "context sensitivity" the thing that is missing to perform the obvious optimization (i=3) on the following code without adding restrict to q? If so, I assume I don't need to file a PR about it... (there are too many PRs that mention alias analysis, I can't find anything) int i; int* g(int n,int*q){ int*p=__builtin_malloc(n); p[2]=3; *q=5; i=p[2]; return p; } (the "easy" cases are when we don't return p (no "global" var) or when p and q have incompatible types (but malloc+memset seems to lose any type I could try to force on the pointer))