develooper Front page | perl.perl5.porters | Postings from November 2012

Re: [perl #115746] [PATCH] clean up inline string comparisons in gv_fetchpvn_flags

Thread Previous | Thread Next
Jan Dubois
November 16, 2012 15:00
Re: [perl #115746] [PATCH] clean up inline string comparisons in gv_fetchpvn_flags
Message ID:
On Fri, Nov 16, 2012 at 12:33 PM, bulk 88 via RT
<> wrote:
> The description of U32_ALIGNMENT_REQUIRED sounds strange to me. It
> implys that 32 bit casting and bitshift are required to manipulate
> strings but that can't be the case. In Digest::MD5 there is actual use
> of U32_ALIGNMENT_REQUIRED, but Digest::MD5's Makefile.PL defines it
> using its own logic and with test compiles so it ignores config.h. So
> globally, the U32_ALIGNMENT_REQUIRED define's description is either
> wrong (probably), or Digest::MD5's repurposing of it is wrong.

Digest::MD5 doesn't trust the config.h value because it can be
incorrect if Perl has been built on a different machine. I believe the
concrete example was Perl compiled on Solaris 8, which implicitly uses
-xmemalign=8i, but installed on Solaris 9, where cc uses -xmemalign=8s
by default. Compiling with 8i means that misaligned accesses are
trapped and interpreted, so U32_ALIGNMENT_REQUIRED is not set in

When you then use this version of Perl on Solaris 9 and try to compile
the Digest::MD5 module with the same compiler and compiler options, it
will now require alignment and generate SIGBUS errors for misaligned

So to avoid future bug reports from users on Solaris 9+ running a Perl
built on Solaris 8, Digest::MD5 doesn't trust config.h on this and
recomputes it at module build time.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About