[cfe-commits] [llvm-commits] PATCH: wide strings alignment fix in clang
Sundeep
sundeepk at codeaurora.org
Tue Aug 2 08:12:55 PDT 2011
Thanks for your reply Takumi. I will repost it to cfe-commits.
-Sundeep
> -----Original Message-----
> From: NAKAMURA Takumi [mailto:geek4civic at gmail.com]
> Sent: Tuesday, August 02, 2011 7:06 AM
> To: Sundeep
> Cc: llvm-commits at cs.uiuc.edu; cfe-commits
> Subject: Re: [llvm-commits] PATCH: wide strings alignment fix in clang
>
> Good evening, Sundeep!
>
> Thanks to submit your patches, though, it was wrong mailing list :p
> You should re-submit to cfe-commits, please.
>
> It seems good functionally to me.
>
> ...Takumi
>
>
> 2011/8/2 Sundeep <sundeepk at codeaurora.org>:
> > Hi All,
> >
> > I have been working on a bug in clang dealing with alignment of wide
> > strings. Clang is aligning wide string literals to 1 byte boundary.
> However,
> > LLVM treats wide strings as 4 byte aligned and generates memory
> operations
> > accessing 4 bytes at a time. This works fine on architectures that
> allow
> > unaligned access. But for architectures which don't allow unaligned
> access,
> > this results in an exception and segfault.
> >
> > I have attached the patch along with a simple test case to reproduce
> the
> > problem.
> >
> > patch.llvm - clang fix to handle wide string literal alignment
> correctly.
> >
> > patch.test - patch to a test case problem in llvm/test regression
> directory.
> >
> > wstr_main.c - declares a string "ab" and a wide string L"AZ" and
> calls foo.
> > String "ab" causes string literal "AZ" to start from an offset of 3
> ('a',
> > 'b', '\0').
> >
> > wstr_copy.c - attempts to copy a single wide char from L"AZ" into a
> global
> > wide string array. This results in unaligned load exception since it
> tries
> > to load 4 bytes from an address which is 3 byte aligned.
> >
> > makefile - makefile to reproduce the problem.
> >
> > failures.txt - failure report and explanation from running llvm/test
> and
> > projects/test-suite.
> >
> > This is my first attempt to commit into LLVM repository. I followed
> > guidelines from "LLVM Developer Policy". Please let me know if I
> missed
> > something or if you guys need any additional information.
> >
> > Thanks,
> > Sundeep
More information about the cfe-commits
mailing list