Description of fix
christos at zoulas.com
Tue May 10 11:07:53 PDT 2011
On May 10, 6:09pm, aph at redhat.com (Andrew Haley) wrote:
-- Subject: Re: Description of fix
| On 05/10/2011 06:00 PM, Azeem Jiva wrote:
| > Sorry forgot to add that if I try to build a 64bit JVM under Ubuntu
| > 11.04 with GCC 4.5.2 I get the following compile time error:
| > /home/azeem/hs/hotspot/src/os/linux/vm/os_linux.cpp: In static member
| > function static bool os::Linux::hugetlbfs_sanity_check(bool, size_t):
| > /home/azeem/hs/hotspot/src/os/linux/vm/os_linux.cpp:2853:43: error: use
| > of assignment suppression and length modifier together in gnu_scanf format
| > The fix is to remove the length modifier.
| That shouldn't be an error, though: it's perfectly correct code.
| I suppose it's a (rather unhelpful) warning that's erroring out
| because of -Werror.
The length specifier does not affect the scanning process (i.e.
the scanner does not stop on overflow, it consumes the whole numeric
string) so the length modifier is superfluous on skipped format
specifiers. Perhaps it is better for portability to remove the
length modifier and call it a day.
main(int argc, char *argv)
static const char b = "123456789012345";
uint64_t x64 = 0, y64 = 0;
uint32_t x32 = 0, y32 = 0;
sscanf(b, "%" SCNu64 "%" SCNu64, &x64, &y64);
printf("x=%" PRIu64 " y=%" PRIu64 "\n", x64, y64);
sscanf(b, "%" SCNu32, &x32, &y32);
printf("x=%" PRIu32 " y=%" PRIu32 "\n", x32, y32);
More information about the hotspot-compiler-dev