This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/35592] Want attribute to enable precision loss warning



------- Comment #6 from felix-gcc at fefe dot de  2008-04-01 19:34 -------
Sure. For example:

  char* c=malloc(lseek(somefd,0,SEEK_END);

on a platform where off_t is 64-bit, but where size_t is 32-bit.  For example:
i686-linux with #define _FILE_OFFSET_BITS 64.

Now that I'm thinking about it, would it be possible to have a generic overflow
warning in that context?  For example,

  malloc(p->len+1)

So that gcc sees I'm adding something there, and if the range is not clamped
down before that gives an error?


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]