From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20476 invoked by alias); 4 Mar 2005 18:01:09 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 20434 invoked by uid 48); 4 Mar 2005 18:01:03 -0000 Date: Fri, 04 Mar 2005 18:01:00 -0000 Message-ID: <20050304180103.20433.qmail@sourceware.org> From: "dnovillo at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20050304153241.20318.jorton@redhat.com> References: <20050304153241.20318.jorton@redhat.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c/20318] RFE: add attribute to specify that a function never returns NULL X-Bugzilla-Reason: CC X-SW-Source: 2005-03/txt/msg00550.txt.bz2 List-Id: ------- Additional Comments From dnovillo at gcc dot gnu dot org 2005-03-04 18:01 ------- Adding some of the early analysis that went on in private mail. > So is there an __attribute__ that we can use to mark that function to > always return non-NULL, so the compiler knows that path is not possible? > No. There is __attribute__ ((noreturn)), but the compiler has no way of knowing that svn_fs_fs__id_parse is guaranteed to return non-NULL. This is what the compiler sees in the IL: root_id_41 = svn_fs_fs__id_parse (node_id_str_39, D.10885_40, pool_5); if (root_id_41 == 0B) goto ; else goto ; :; svn_error__locate (...); D.10887_45 = dgettext (...); svn_err__temp_46 = svn_error_create (160004, 0B, D.10887_45); # root_id_257 = PHI ; :; [ ... ] :; *root_id_p_30 = root_id_257; At L19, it sees two possible values for root_id (root_id_28 and root_id_41). root_id_28 is the uninitialized value. We don't have a "can't return NULL" attribute. Though it would be useful. In this case, you're better off initializing *root_id_p at the start of the function. Diego. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20318