diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/g++.old-deja/g++.brendan/crash66.C | |
download | cbb-gcc-4.6.4-upstream.tar.bz2 cbb-gcc-4.6.4-upstream.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.brendan/crash66.C')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.brendan/crash66.C | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash66.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash66.C new file mode 100644 index 000000000..321c55130 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash66.C @@ -0,0 +1,137 @@ +// { dg-do assemble } +// { dg-options "-O" } +// GROUPS passed old-abort +typedef unsigned char uchar; +typedef unsigned short ushort; +typedef unsigned long ulong; +extern int swap_endian; +inline ushort +swapshort(ushort value) +{ + value &= 0xffff; + return ((value << 8) | (value >> 8)); +} +struct eshort +{ + ushort data; + operator ushort() { return swap_endian ? swapshort(data) : data;} + eshort(ushort t) { data = swap_endian ? swapshort(t) : t;} + eshort() {} +}; +inline ulong +swaplong(ulong value) +{ + ulong v = (value << 16) | (value >> 16); + return ((v >> 8) & 0x00ff00ff) | ((v << 8) & 0xff00ff00); +} +struct elong +{ + ulong data; + operator ulong() { return swap_endian ? swaplong(data) : data;} + elong(ulong t) { data = swap_endian ? swaplong(t) : t; } + elong() {} +}; +struct digiheader +{ + uchar type[2]; + eshort soft_version; + eshort lo_boot_rev; + eshort hi_boot_rev; + eshort load_segment; + eshort length; + eshort exec_start; + eshort image_offset; + elong startup_code[2]; + elong checksum; +}; +extern void uncompress(uchar* buf, ulong len); +extern ulong compress(char* filename, uchar* buffer, ulong); +struct filehdr +{ + eshort f_magic; + eshort f_nscns; + elong f_timdat; + elong f_symptr; + elong f_nsyms; + eshort f_opthdr; + eshort f_flags; +}; +struct aouthdr +{ + eshort magic; + eshort vstamp; + elong tsize; + elong dsize; + elong bsize; + elong entry; + elong text_start; + elong data_start; + elong bss_start; + elong gprmask; + elong cprmask[4]; + elong gp_value; +}; +struct scnhdr +{ + char s_name[8]; + elong s_paddr; + elong s_vaddr; + elong s_size; + elong s_scnptr; + elong s_relptr; + elong s_lnnoptr; + eshort s_nreloc; + eshort s_nlnno; + elong s_flags; +}; +int file_little_endian; +int host_little_endian; +int swap_endian; +int docheck; +int expand; +ulong memsize; +ulong compression_quality; +char *compressfile; +int debug_level; +extern "C" int getopt (int, char**, const char*); +int +main(int argc, char** argv) +{ + uchar checksum; + uchar docrc; + ulong len; + ulong maxlen; + int i; + int c; + int magic; + int tsize; + int dsize; + int quality; + char dummy; + uchar* code; + uchar* buf; + char* ap; + digiheader *dh; + compression_quality = 10000; + docheck = 0; + while ((c = getopt(argc, argv, "Ccdf:k:q:x:")) != -1) + { + switch (c) + { + default: + goto usage; + } + } + if ((expand && (docheck || compressfile || quality)) || + (quality && !compressfile)) + { + usage: + return(2); + } + if (compressfile) + { + dh->image_offset = len; + + len += compress(compressfile, code + len, maxlen - len); + } +} |