This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug math/13268] New: modf, modff, modfl: help GCC with argument checking
- From: "bruno at clisp dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Wed, 05 Oct 2011 23:43:45 +0000
- Subject: [Bug math/13268] New: modf, modff, modfl: help GCC with argument checking
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=13268
Bug #: 13268
Summary: modf, modff, modfl: help GCC with argument checking
Product: glibc
Version: 2.11
Status: NEW
Severity: normal
Priority: P2
Component: math
AssignedTo: aj@suse.de
ReportedBy: bruno@clisp.org
Classification: Unclassified
The second argument of the functions modf, modff, modfl must not be a NULL
pointer, according to POSIX, and the glibc implementation also does not allow
a NULL pointer.
It would be useful to allow GCC to give a warning when someone passes a NULL
literal to these functions.
How to reproduce:
==================== foo.c ========================
#include <math.h>
#include <stddef.h>
int
main ()
{
return ! modf (2.4, NULL);
}
===================================================
$ gcc -Wall foo.c
Expected result:
foo.c: In function 'main':
foo.c:6:3: warning: null argument where non-null required (argument 2)
Actual result:
No diagnostic.
The fix should be easy: Add a properly conditionalized
__attribute__ ((__nonnull__ (2)))
to glibc/math/bits/mathcalls.h line 116.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.