This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, libgfortran] PR39665, alignment problems


On Fri, Apr 10, 2009 at 12:28 AM, Janne Blomqvist
<blomqvist.janne@gmail.com> wrote:
> Steve Ellcey wrote:
>>> Thanks for the review. However, after thinking about this some more
>>> myself, I came to the conclusion that considering the requirement to
>>> handle repeat counts, my other proposal to just align u.p.value is better.
>>>
>>> Hence I instead committed the attached patch as obvious (r145852).
>>>
>>> --
>>> Janne Blomqvist
>>
>> This patch seems to cause new failures for me. ?I am getting failures in
>> gfortran.dg/f2003_io_[14567].f03 (maybe more, I stopped testing there).
>>
>> $ gfortran -g f2003_io_5.f03 -o x
>> $ ./x
>> At line 12 of file f2003_io_5.f03 (unit = 99, file = 'mynml')
>> Fortran runtime error: Bad DECIMAL parameter in data transfer statement
>>
>> Steve Ellcey
>> sje@cup.hp.com
>
> I've reverted this patch and instead committed the original one as r145875.
>
> Though I'm a bit perplexed why the alignment attribute didn't work. Is
> __attribute__ ((aligned (__BIGGEST_ALIGNMENT__)))
> fundamentally broken? Even more so, how can it cause regressions on
> targets that worked before?

From doc/extend.texi:

---
Gcc also provides a target specific macro @code{__BIGGEST_ALIGNMENT__},
which is the largest alignment ever used for any data type on the
target machine you are compiling for.  For example, you could write:

@smallexample
short array[3] __attribute__ ((aligned (__BIGGEST_ALIGNMENT__)));
@end smallexample

The compiler automatically sets the alignment for the declared
variable or field to @code{__BIGGEST_ALIGNMENT__}.  Doing this can
often make copy operations more efficient, because the compiler can
use whatever instructions copy the biggest chunks of memory when
performing copies to or from the variables or fields that you have
aligned this way.  Note that the value of @code{__BIGGEST_ALIGNMENT__}
may change depending on command line options.
---

You really don't want to use __BIGGEST_ALIGNMENT__ in
a library since __BIGGEST_ALIGNMENT__ may change depend on
command line options.


-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]