• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Miscellaneous XCode Questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Miscellaneous XCode Questions


  • Subject: Re: Miscellaneous XCode Questions
  • From: Eric Albert <email@hidden>
  • Date: Thu, 11 May 2006 23:48:43 -0700

On May 11, 2006, at 11:16 PM, Ben Weiss wrote:

On May 11, 2006, at 10:44 PM, Chris Espinosa wrote:
On May 11, 2006, at 10:28 PM, Ben Weiss wrote:

3. When a pointer (to say, a char) is cast to a vUInt16* pointer, gcc implicitly assumes that it is 16-byte aligned, and loads data with movdqa. Is it legal for gcc to assume this? Do misaligned loads always have to be coded explicitly?

That depends processor model to processor model.  Use the #pragma align directives to control alignment explicitly, but the compiler will never (knock wood) generate illegal instruction alignment for a particular processor.

This is for x86, where misaligned vector loads are legal, but use a different load instruction. My code is trying to read 16 contiguous bytes from an array, from an arbitrary (possibly misaligned) starting index. Something like this:

vuint8 load(uint8* p) { return *(vuint8*)p; }

The compiler assumes that p is aligned and generates an aligned load instruction, which causes an alignment exception and crash. I would think that the compiler, not knowing whether the pointer is aligned, should not be making this assumption... Most stack-based data is known at compile-time to be aligned, but not arbitrary pointers. I haven't found this behavior documented anywhere one way or the other.

What you've described would definitely be a codegen bug.  Can you file a bug report?  Attach a pre-processed version of the file (get it by passing -save-temps to the compiler -- it'll generate a .i or .ii file) and give us the command line used to invoke the compiler, which you can get from Xcode's detailed build log.

Thanks,
Eric

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >(no subject) (From: Aurélien Ammeloot <email@hidden>)
 >Miscellaneous XCode Questions (From: Ben Weiss <email@hidden>)
 >Re: Miscellaneous XCode Questions (From: Chris Espinosa <email@hidden>)
 >Re: Miscellaneous XCode Questions (From: Ben Weiss <email@hidden>)

  • Prev by Date: Re: Miscellaneous XCode Questions
  • Next by Date: Bundling bundles in framework
  • Previous by thread: Re: Miscellaneous XCode Questions
  • Next by thread: Re: Miscellaneous XCode Questions
  • Index(es):
    • Date
    • Thread