Boost logo

Boost :

From: Ralf W. Grosse-Kunstleve (rwgk_at_[hidden])
Date: 2003-11-05 14:48:44


Hi Doug,

Mike Owen reports the same problem while compiling Boost.Python extensions
under AIX with g++ 3.2.1 and 3.2.3. type_with_alignment.hpp does not cope with
a type that is 8-byte aligned.

We have established that the little test below runs under AIX without crashing.
>From that we conclude that AIX does not have strict alignment requirements,
just like the PowerPC Macintosh. Would it seem reasonable to check in the
trivial patch below?

Thanks,
        Ralf

--- Douglas Gregor <gregod_at_[hidden]> wrote:
> ----- Original Message -----
> From: "Ralf W. Grosse-Kunstleve" <rwgk_at_[hidden]>
> To: "Boost mailing list" <boost_at_[hidden]>
> Sent: Saturday, June 07, 2003 5:50 AM
> Subject: Re: [boost] Mac OS 10 & type_traits/type_with_alignment.hpp
>
>
> > --- Douglas Gregor <gregod_at_[hidden]> wrote:
> > /var/tmp/mac/boost/boost/type_traits/type_with_alignment.hpp:120:
> > error: no type named `type' in `boost::maybe_print_align<false, 8, 4>'
>
> So you have a type that is 8-byte aligned, but we don't have any types in
> the list of possible types that have an alignment of 8 on that architecture,
> so it fails. We'll just have to find a type that has 8-byte alignment and
> add it to the list. I'll see if I can dig one up tomorrow.
>
> Doug

#include <iostream>

int main(void)
{
  char buf[2*sizeof(double)];
  for(int i=0;i<sizeof(double);i++) {
    double* d = (double*) &buf[i];
    *d = 120.+i;
    std::cout << *d << std::endl;
  }
}

Index: boost/type_traits/type_with_alignment.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/type_traits/type_with_alignment.hpp,v
retrieving revision 1.14
diff -u -r1.14 type_with_alignment.hpp
--- boost/type_traits/type_with_alignment.hpp 3 Sep 2003 15:19:12 -0000 1.14
+++ boost/type_traits/type_with_alignment.hpp 4 Nov 2003 00:31:00 -0000
@@ -132,7 +132,7 @@
 
     BOOST_STATIC_CONSTANT(std::size_t, found = alignment_of<align_t>::value);
 
-#if !(defined(__APPLE__) && defined(__MACH__) && defined(__GNUC__))
+#if !(((defined(__APPLE__) && defined(__MACH__)) || defined(_AIX)) &&
defined(__GNUC__))
     BOOST_STATIC_ASSERT(found >= Align);
     BOOST_STATIC_ASSERT(found % Align == 0);
 #endif

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk