This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/35592] Want attribute to enable precision loss warning
- From: "felix-gcc at fefe dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Apr 2008 19:34:27 -0000
- Subject: [Bug c/35592] Want attribute to enable precision loss warning
- References: <bug-35592-3511@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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