[rfa/testsuite] Extend signull to work with discriptors
Andrew Cagney
cagney@gnu.org
Wed Jun 16 14:54:00 GMT 2004
> Needs more work:
>
> - copyright year 2004 in signull.c
>
> - did you test it on ia64 and/or ppc?
> can't quite tell from your wording
yep, and also tested on fc2 i386.
> - this code has ISO problems.
That's to put it mildly. The trick it's pulling with function
descriptors isn't valid ISO-C (but by knowing how descriptors work does
lead to predictable behavior ... :-)
We're going to have to live with this - the testsuite needs to include
deliberately erroneous programs.
> % cat ptr.c
> typedef long data_t;
> typedef long code_t (void);
> volatile data_t zero[10];
> volatile code_t *desc = (void *) zero;
>
> % gcc-340 -Wall -S -pedantic -std=iso9899:1990 ptr.c
> ptr.c:4: warning: ISO C forbids qualified function types
> ptr.c:4: warning: ISO C forbids initialization between function pointer and `void *'
>
> What about:
>
> code_t * volatile desc = 0;
> But that's semantically different from what you wrote. Hmmm. I don't
> think it's possible in ISO C to initialize a pointer-to-code with the
> address of a data object. Any ideas?
This:
code_t *volatile desc = (code_t *) (void *) zero;
does appear to fool the compiler.
see attched,
Andrew
> ===
>
> 2004-06-15 Andrew Cagney <cagney@gnu.org>
>
> * gdb.base/signull.c (bowler): Replace data_pointer with data_read
> and data_write cases. Add code_descriptor case.
> (zero, desc): New array and pointer.
> (data, code): Change to simple pointers.
> * gdb.base/signull.exp: Fix probe pattern matching a function
> descriptor SIGSEGV. Replace data_pointer with data_read and
> data_write tests.
>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diffs
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20040616/5fed88dd/attachment.ksh>
More information about the Gdb-patches
mailing list