[Bug c/20318] RFE: add attribute to specify that a function never returns NULL

2013-10-11 Thread glisse at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20318

Marc Glisse glisse at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||glisse at gcc dot gnu.org
 Resolution|--- |FIXED

--- Comment #11 from Marc Glisse glisse at gcc dot gnu.org ---
Marking svn_fs_fs__id_parse and svn_error_create with the new
__attribute__((__returns_nonnull__)) makes the warning about root_id disappear
at -O3, so I am going to mark this bug as fixed, please reopen if necessary.


[Bug c/20318] RFE: add attribute to specify that a function never returns NULL

2013-10-09 Thread glisse at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20318

--- Comment #10 from Marc Glisse glisse at gcc dot gnu.org ---
Author: glisse
Date: Wed Oct  9 13:03:13 2013
New Revision: 203316

URL: http://gcc.gnu.org/viewcvs?rev=203316root=gccview=rev
Log:
2013-10-09  Marc Glisse  marc.gli...@inria.fr

PR tree-optimization/20318
gcc/c-family/
* c-common.c (handle_returns_nonnull_attribute): New function.
(c_common_attribute_table): Add returns_nonnull.

gcc/
* doc/extend.texi (returns_nonnull): New function attribute.
* fold-const.c (tree_expr_nonzero_warnv_p): Look for returns_nonnull
attribute.
* tree-vrp.c (gimple_stmt_nonzero_warnv_p): Likewise.
(stmt_interesting_for_vrp): Accept all GIMPLE_CALL.

gcc/testsuite/
* c-c++-common/pr20318.c: New file.
* gcc.dg/tree-ssa/pr20318.c: New file.

Added:
trunk/gcc/testsuite/c-c++-common/pr20318.c   (with props)
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr20318.c   (with props)
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c-common.c
trunk/gcc/doc/extend.texi
trunk/gcc/fold-const.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-vrp.c

Propchange: trunk/gcc/testsuite/c-c++-common/pr20318.c
('svn:eol-style' added)

Propchange: trunk/gcc/testsuite/c-c++-common/pr20318.c
('svn:keywords' added)

Propchange: trunk/gcc/testsuite/gcc.dg/tree-ssa/pr20318.c
('svn:eol-style' added)

Propchange: trunk/gcc/testsuite/gcc.dg/tree-ssa/pr20318.c
('svn:keywords' added)


[Bug c/20318] RFE: add attribute to specify that a function never returns NULL

2006-01-09 Thread pinskia at gcc dot gnu dot org


--- Comment #9 from pinskia at gcc dot gnu dot org  2006-01-09 18:34 ---
No longer working on this, I am too busy working on the gfortran front-end.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|pinskia at gcc dot gnu dot  |unassigned at gcc dot gnu
   |org |dot org
 Status|ASSIGNED|NEW


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20318




[Bug c/20318] RFE: add attribute to specify that a function never returns NULL

2005-11-12 Thread pinskia at gcc dot gnu dot org


--- Comment #8 from pinskia at gcc dot gnu dot org  2005-11-12 19:26 ---
I have a patch already.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|dnovillo at gcc dot gnu dot |pinskia at gcc dot gnu dot
   |org |org
 Status|NEW |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20318



[Bug c/20318] RFE: add attribute to specify that a function never returns NULL

2005-11-11 Thread green at redhat dot com


--- Comment #7 from green at redhat dot com  2005-11-11 23:29 ---
This feature would also be useful for java, as we can eliminate certain inlined
null pointer checks when we know that a method can't return null.
See http://gcc.gnu.org/ml/java/2005-11/msg00124.html


-- 

green at redhat dot com changed:

   What|Removed |Added

 CC||green at redhat dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20318



[Bug c/20318] RFE: add attribute to specify that a function never returns NULL

2005-06-03 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-03 
14:20 ---
Here is a reduced testcase for the SVN code:
void *g();

static void *count_and_verify_instructions(int *ninst,const unsigned char *p)
{
   if (p == ((void *)0))
return g();
 *ninst = 0;
 return 0;
}
void f(int);
void *decode_window(const unsigned char *data)
{
  int ninst;
  void *svn_err__temp = count_and_verify_instructions(ninst, data);
  if (svn_err__temp)
return svn_err__temp;

  f (ninst);
  return 0;
}
- cut -
g returns only non null values.

This reduced testcase comes from PR 21320 which comes from OLH.

-- 
   What|Removed |Added

   Last reconfirmed|2005-03-04 15:38:22 |2005-06-03 14:20:19
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20318


[Bug c/20318] RFE: add attribute to specify that a function never returns NULL

2005-03-04 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-04 
15:38 ---
Confirmed, PR 19476 is case which depends on this.

-- 
   What|Removed |Added

 CC||pinskia at gcc dot gnu dot
   ||org
OtherBugsDependingO||19476
  nThis||
 Status|UNCONFIRMED |NEW
 Ever Confirmed||1
   Keywords||diagnostic, missed-
   ||optimization
   Last reconfirmed|-00-00 00:00:00 |2005-03-04 15:38:22
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20318


[Bug c/20318] RFE: add attribute to specify that a function never returns NULL

2005-03-04 Thread giovannibajo at libero dot it

--- Additional Comments From giovannibajo at libero dot it  2005-03-04 
17:53 ---
I don't object that this feature is indeed needed, but I would still like to 
see a reduced testcase from Subversion which shows a bogus warning that could 
be fixed with this attribute.

BTW, Diego, once ASSERT_EXPR becomes a generic node, can't just the C++ FE uses 
it to assert that the return value for a CALL_EXPR to an allocation function is 
non-zero?

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20318


[Bug c/20318] RFE: add attribute to specify that a function never returns NULL

2005-03-04 Thread dnovillo at redhat dot com

--- Additional Comments From dnovillo at redhat dot com  2005-03-04 17:59 
---
Subject: Re:  RFE: add attribute to specify that a function never
 returns NULL

giovannibajo at libero dot it wrote:
 --- Additional Comments From giovannibajo at libero dot it  2005-03-04 
 17:53 ---
 I don't object that this feature is indeed needed, but I would still like to 
 see a reduced testcase from Subversion which shows a bogus warning that could 
 be fixed with this attribute.
 
I have attached the pre-processed test case from Joe.

 BTW, Diego, once ASSERT_EXPR becomes a generic node, can't just the C++ FE 
 uses 
 it to assert that the return value for a CALL_EXPR to an allocation function 
 is 
 non-zero?
 
The attribute would be enough.  The FE need only set an ECF_ flag to the 
CALL_EXPR and the optimizers will pick it up from there.


Diego.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20318