This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [RFA 2/6] Handle alignof and _Alignof


>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> Shouldn't we test "long double"?  Patch #1 handles it.
Pedro> Not sure all GCC ports support it, may require separate compilation.

I thought C didn't have long double (it's tested in the C++ test), but I
see it does.  I will add that.

Pedro> Also, I'm wondering about "__int128" if the target
Pedro> supports it.

I have bad feelings about trying to detect this in the test.

Pedro> In C++, do we get the alignment of non-standard layout classes right?
Pedro> Likewise arrays, bitfields and typedefs?
Pedro> What do we do with _Alignof(void)?

I will add these.

Pedro> I didn't spot any test for the
Pedro>  "could not determine alignment of type"
Pedro> case to make that that works gracefully without crashing.  

I think this one is maybe hard to test without some kind of bug (so far
I've only seen it when some part of the patch was buggy), but I will see
what I can do.

Pedro> Finally, for completeness, GCC allows _Alignof applied to
Pedro> expressions, so I guess we should to.  Does the series allow that?
Pedro> I.e., can we do _Alignof(1 + 1)?  Does the parser handle that?

No, and this is hard to do.  I've left the door open a bit by the way
the new expression emits a new OP instead of simply writing out a
constant (and this allows alignof(typeof(..)) to work as well).
However, I think the way the parser is written makes this difficult,
which is one reason that sizeof requires or does not require parens
depending on whether the argument is an expression or a type.

It would be possible to write "alignof expression", but I didn't want to
add an extension, especially since "alignof(typeof(expression))" is
pretty easy.

Pedro> Shouldn't we test _Alignof applied to the structure fields too?

It seems to me that this would necessarily be an expression, not a type.

Pedro> There was a snippet in the patch that made me wonder if the patch
Pedro> handles alignof of a no-debug-info variable and and the return-type
Pedro> of a no-debug-info function correctly (instead of e.g., crashing).
Pedro> I'd be nice to add a couples test to gdb.base/nodebug.exp
Pedro> to make sure.  E.g.:
Pedro>    p _Alignof (dataglobal64_1)
Pedro>    p _Alignof (middle())"

Pedro> Also, please add intro comments to the testcase .exp files, so
Pedro> that later on people can find out what the testcase is
Pedro> about easily.

Ok to all.

Tom


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