This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix pointer to integer cast in null_printf check 53/head
authorNiko Tyni <ntyni@debian.org>
Sat, 24 Mar 2018 14:49:06 +0000 (16:49 +0200)
committerNiko Tyni <ntyni@debian.org>
Sat, 24 Mar 2018 14:49:06 +0000 (16:49 +0200)
commit16e38bb83cd44f36aea3c39f90903f640fac3572
tree8c9489e860737532c640ed0ba394624720055195
parent5e4145e400132d1a5f32467b10dbd4c6ea16f91b
Fix pointer to integer cast in null_printf check

Quoting James Cowgill in https://bugs.debian.org/893601

> I recently noticed a build failure in the "mrs" package which embeds the
> perl interpreter. The strange part was that the error looked completely
> generic but only failed on 32-bit for some reason. I traced this to the
> value of the PRINTF_FORMAT_NULL_OK config,h option in perl which is
> defined on 32-bit, but not defined on 64-bit architectures. This is a
> bug because this check detects the behavior of the compiler and should
> be the same on all architectures with the same GCC version.
>
> The underlying bug is that the check for this warning causes GCC to emit
> an unrelated warning on 64-bit arches which tricks the check into not
> defining PRINTF_FORMAT_NULL_OK.
>
> The line which causes the warning is:
>  int null_printf (char* pat,...) { return (int)pat; }
>
> GCC complains about the pointer to integer cast of the wrong size but
> only on 64-bits. I've attached a patch to fix this by casting through
> intptr_t first.

Bug-Debian: https://bugs.debian.org/893601
U/modified/d_attribut.U