diff options
author | no-author <no-author@gcc.gnu.org> | 1998-12-06 02:16:21 +0000 |
---|---|---|
committer | no-author <no-author@gcc.gnu.org> | 1998-12-06 02:16:21 +0000 |
commit | 1636143ecd7b8ce10119e605f67dd7eb2e6a96e8 (patch) | |
tree | 243923335b574a60c0c73bd4dd536690d26207d0 | |
parent | 43b1cda36f393767f845a840f4bdd7ef9090de5d (diff) |
This commit was manufactured by cvs2svn to create branch
'ffixinc-branch'.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ffixinc-branch@24128 138bc75d-0d04-0410-961f-82ee72b054a4
63 files changed, 2820 insertions, 0 deletions
diff --git a/gcc/config/elfos.h b/gcc/config/elfos.h new file mode 100644 index 00000000000..ad1c3f5aeb6 --- /dev/null +++ b/gcc/config/elfos.h @@ -0,0 +1,755 @@ +/* elfos.h -- operating system specific defines to be used when + targeting GCC for some generic ELF system + Copyright (C) 1991, 1994, 1995 Free Software Foundation, Inc. + Based on svr4.h contributed by Ron Guilmette (rfg@netcom.com). + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +/* For the sake of libgcc2.c, indicate target supports atexit. */ +#define HAVE_ATEXIT + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC "crtend.o%s" + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "%{!shared: \ + %{!symbolic: \ + %{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}\ + crtbegin.o%s" + +/* Attach a special .ident directive to the end of the file to identify + the version of GCC which compiled this code. The format of the + .ident string is patterned after the ones produced by native svr4 + C compilers. */ + +#define IDENT_ASM_OP ".ident" + +#define ASM_FILE_END(FILE) \ +do { \ + fprintf ((FILE), "\t%s\t\"GCC: (GNU) %s\"\n", \ + IDENT_ASM_OP, version_string); \ + } while (0) + +/* Output #ident as a .ident. */ + +#define ASM_OUTPUT_IDENT(FILE, NAME) \ + fprintf (FILE, "\t%s\t\"%s\"\n", IDENT_ASM_OP, NAME); + +/* Use periods rather than dollar signs in special g++ assembler names. */ + +#define NO_DOLLAR_IN_LABEL + +/* Writing `int' for a bitfield forces int alignment for the structure. */ + +#define PCC_BITFIELD_TYPE_MATTERS 1 + +/* Implicit library calls should use memcpy, not bcopy, etc. */ + +#define TARGET_MEM_FUNCTIONS + +/* Handle #pragma weak and #pragma pack. */ + +#define HANDLE_SYSV_PRAGMA + +/* System V Release 4 uses DWARF debugging info. */ + +#define DWARF_DEBUGGING_INFO + +/* All ELF targets can support DWARF-2. */ + +#define DWARF2_DEBUGGING_INFO + +/* gas on SVR4 supports the use of .stabs. Permit -gstabs to be used + in general, although it will only work when using gas. */ + +#define DBX_DEBUGGING_INFO + +/* The GNU tools operate better with stabs. Since we don't have + any native tools to be compatible with, default to stabs. */ + +#ifndef PREFERRED_DEBUGGING_TYPE +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG +#endif + +/* Make LBRAC and RBRAC addresses relative to the start of the + function. The native Solaris stabs debugging format works this + way, gdb expects it, and it reduces the number of relocation + entries. */ + +#define DBX_BLOCKS_FUNCTION_RELATIVE 1 + +/* When using stabs, gcc2_compiled must be a stabs entry, not an + ordinary symbol, or gdb won't see it. Furthermore, since gdb reads + the input piecemeal, starting with each N_SO, it's a lot easier if + the gcc2 flag symbol is *after* the N_SO rather than before it. So + we emit an N_OPT stab there. */ + +#define ASM_IDENTIFY_GCC(FILE) \ +do \ + { \ + if (write_symbols != DBX_DEBUG) \ + fputs ("gcc2_compiled.:\n", FILE); \ + } \ +while (0) + +#define ASM_IDENTIFY_GCC_AFTER_SOURCE(FILE) \ +do \ + { \ + if (write_symbols == DBX_DEBUG) \ + fputs ("\t.stabs\t\"gcc2_compiled.\", 0x3c, 0, 0, 0\n", FILE); \ + } \ +while (0) + +/* Like block addresses, stabs line numbers are relative to the + current function. */ + +#undef ASM_OUTPUT_SOURCE_LINE +#define ASM_OUTPUT_SOURCE_LINE(file, line) \ +do \ + { \ + static int sym_lineno = 1; \ + fprintf (file, "\t.stabn 68,0,%d,.LM%d-", \ + line, sym_lineno); \ + assemble_name (file, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \ + fprintf (file, "\n.LM%d:\n", sym_lineno); \ + sym_lineno += 1; \ + } \ +while (0) + +/* In order for relative line numbers to work, we must output the + stabs entry for the function name first. */ + +#define DBX_FUNCTION_FIRST + +#undef ASM_BYTE_OP +#define ASM_BYTE_OP ".byte" + +#undef SET_ASM_OP +#define SET_ASM_OP ".set" + +/* This is how to begin an assembly language file. Most svr4 assemblers want + at least a .file directive to come first, and some want to see a .version + directive come right after that. Here we just establish a default + which generates only the .file directive. If you need a .version + directive for any specific target, you should override this definition + in the target-specific file which includes this one. */ + +#undef ASM_FILE_START +#define ASM_FILE_START(FILE) \ + output_file_directive ((FILE), main_input_filename) + +/* This is how to allocate empty space in some section. The .zero + pseudo-op is used for this on most svr4 assemblers. */ + +#define SKIP_ASM_OP ".zero" + +#undef ASM_OUTPUT_SKIP +#define ASM_OUTPUT_SKIP(FILE,SIZE) \ + fprintf (FILE, "\t%s\t%u\n", SKIP_ASM_OP, (SIZE)) + +/* This is how to output a reference to a user-level label named NAME. + `assemble_name' uses this. + + For System V Release 4 the convention is *not* to prepend a leading + underscore onto user-level symbol names. */ + +#undef ASM_OUTPUT_LABELREF +#define ASM_OUTPUT_LABELREF(FILE,NAME) fprintf (FILE, "%s", NAME) + +/* This is how to output an internal numbered label where + PREFIX is the class of label and NUM is the number within the class. + + For most svr4 systems, the convention is that any symbol which begins + with a period is not put into the linker symbol table by the assembler. */ + +#undef ASM_OUTPUT_INTERNAL_LABEL +#define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \ +do { \ + fprintf (FILE, ".%s%d:\n", PREFIX, NUM); \ +} while (0) + +/* This is how to store into the string LABEL + the symbol_ref name of an internal numbered label where + PREFIX is the class of label and NUM is the number within the class. + This is suitable for output with `assemble_name'. + + For most svr4 systems, the convention is that any symbol which begins + with a period is not put into the linker symbol table by the assembler. */ + +#undef ASM_GENERATE_INTERNAL_LABEL +#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ +do { \ + sprintf (LABEL, "*.%s%d", PREFIX, NUM); \ +} while (0) + +/* Output the label which precedes a jumptable. Note that for all svr4 + systems where we actually generate jumptables (which is to say every + svr4 target except i386, where we use casesi instead) we put the jump- + tables into the .rodata section and since other stuff could have been + put into the .rodata section prior to any given jumptable, we have to + make sure that the location counter for the .rodata section gets pro- + perly re-aligned prior to the actual beginning of the jump table. */ + +#define ALIGN_ASM_OP ".align" + +#ifndef ASM_OUTPUT_BEFORE_CASE_LABEL +#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \ + ASM_OUTPUT_ALIGN ((FILE), 2); +#endif + +#undef ASM_OUTPUT_CASE_LABEL +#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \ + do { \ + ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE) \ + ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); \ + } while (0) + +/* The standard SVR4 assembler seems to require that certain builtin + library routines (e.g. .udiv) be explicitly declared as .globl + in each assembly file where they are referenced. */ + +#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ + ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0)) + +/* This says how to output assembler code to declare an + uninitialized external linkage data object. Under SVR4, + the linker seems to want the alignment of data objects + to depend on their types. We do exactly that here. */ + +#define COMMON_ASM_OP ".comm" + +#undef ASM_OUTPUT_ALIGNED_COMMON +#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ +do { \ + fprintf ((FILE), "\t%s\t", COMMON_ASM_OP); \ + assemble_name ((FILE), (NAME)); \ + fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \ +} while (0) + +/* This says how to output assembler code to declare an + uninitialized internal linkage data object. Under SVR4, + the linker seems to want the alignment of data objects + to depend on their types. We do exactly that here. */ + +#define LOCAL_ASM_OP ".local" + +#undef ASM_OUTPUT_ALIGNED_LOCAL +#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ +do { \ + fprintf ((FILE), "\t%s\t", LOCAL_ASM_OP); \ + assemble_name ((FILE), (NAME)); \ + fprintf ((FILE), "\n"); \ + ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \ +} while (0) + +/* This is the pseudo-op used to generate a 32-bit word of data with a + specific value in some section. This is the same for all known svr4 + assemblers. */ + +#define INT_ASM_OP ".long" + +/* This is the pseudo-op used to generate a contiguous sequence of byte + values from a double-quoted string WITHOUT HAVING A TERMINATING NUL + AUTOMATICALLY APPENDED. This is the same for most svr4 assemblers. */ + +#undef ASCII_DATA_ASM_OP +#define ASCII_DATA_ASM_OP ".ascii" + +/* Support const sections and the ctors and dtors sections for g++. + Note that there appears to be two different ways to support const + sections at the moment. You can either #define the symbol + READONLY_DATA_SECTION (giving it some code which switches to the + readonly data section) or else you can #define the symbols + EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and + SELECT_RTX_SECTION. We do both here just to be on the safe side. */ + +#define USE_CONST_SECTION 1 + +#define CONST_SECTION_ASM_OP ".section\t.rodata" + +/* Define the pseudo-ops used to switch to the .ctors and .dtors sections. + + Note that we want to give these sections the SHF_WRITE attribute + because these sections will actually contain data (i.e. tables of + addresses of functions in the current root executable or shared library + file) and, in the case of a shared library, the relocatable addresses + will have to be properly resolved/relocated (and then written into) by + the dynamic linker when it actually attaches the given shared library + to the executing process. (Note that on SVR4, you may wish to use the + `-z text' option to the ELF linker, when building a shared library, as + an additional check that you are doing everything right. But if you do + use the `-z text' option when building a shared library, you will get + errors unless the .ctors and .dtors sections are marked as writable + via the SHF_WRITE attribute.) */ + +#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"aw\"" +#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\"" + +/* On svr4, we *do* have support for the .init and .fini sections, and we + can put stuff in there to be executed before and after `main'. We let + crtstuff.c and other files know this by defining the following symbols. + The definitions say how to change sections to the .init and .fini + sections. This is the same for all known svr4 assemblers. */ + +#define INIT_SECTION_ASM_OP ".section\t.init" +#define FINI_SECTION_ASM_OP ".section\t.fini" + +/* A default list of other sections which we might be "in" at any given + time. For targets that use additional sections (e.g. .tdesc) you + should override this definition in the target-specific file which + includes this file. */ + +#undef EXTRA_SECTIONS +#define EXTRA_SECTIONS in_const, in_ctors, in_dtors + +/* A default list of extra section function definitions. For targets + that use additional sections (e.g. .tdesc) you should override this + definition in the target-specific file which includes this file. */ + +#undef EXTRA_SECTION_FUNCTIONS +#define EXTRA_SECTION_FUNCTIONS \ + CONST_SECTION_FUNCTION \ + CTORS_SECTION_FUNCTION \ + DTORS_SECTION_FUNCTION + +#define READONLY_DATA_SECTION() const_section () + +extern void text_section (); + +#define CONST_SECTION_FUNCTION \ +void \ +const_section () \ +{ \ + if (!USE_CONST_SECTION) \ + text_section(); \ + else if (in_section != in_const) \ + { \ + fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ + in_section = in_const; \ + } \ +} + +#define CTORS_SECTION_FUNCTION \ +void \ +ctors_section () \ +{ \ + if (in_section != in_ctors) \ + { \ + fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ + in_section = in_ctors; \ + } \ +} + +#define DTORS_SECTION_FUNCTION \ +void \ +dtors_section () \ +{ \ + if (in_section != in_dtors) \ + { \ + fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ + in_section = in_dtors; \ + } \ +} + +/* Switch into a generic section. + This is currently only used to support section attributes. */ + +#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \ +do { \ + static struct section_info \ + { \ + struct section_info *next; \ + char *name; \ + enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \ + } *sections; \ + struct section_info *s; \ + char *mode; \ + enum sect_enum type; \ + \ + for (s = sections; s; s = s->next) \ + if (!strcmp (NAME, s->name)) \ + break; \ + \ + if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \ + type = SECT_EXEC, mode = "ax"; \ + else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \ + type = SECT_RO, mode = "a"; \ + else \ + type = SECT_RW, mode = "aw"; \ + \ + if (s == 0) \ + { \ + s = (struct section_info *) xmalloc (sizeof (struct section_info)); \ + s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \ + strcpy (s->name, NAME); \ + s->type = type; \ + s->next = sections; \ + sections = s; \ + fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, mode); \ + } \ + else \ + { \ + if (DECL && s->type != type) \ + error_with_decl (DECL, "%s causes a section type conflict"); \ + \ + fprintf (FILE, ".section\t%s\n", NAME); \ + } \ +} while (0) + +#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1) +#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL)) +#define UNIQUE_SECTION(DECL,RELOC) \ +do { \ + int len; \ + char *name, *string, *prefix; \ + \ + name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \ + \ + if (! DECL_ONE_ONLY (DECL)) \ + { \ + if (TREE_CODE (DECL) == FUNCTION_DECL) \ + prefix = ".text."; \ + else if (DECL_READONLY_SECTION (DECL, RELOC)) \ + prefix = ".rodata."; \ + else \ + prefix = ".data."; \ + } \ + else if (TREE_CODE (DECL) == FUNCTION_DECL) \ + prefix = ".gnu.linkonce.t."; \ + else if (DECL_READONLY_SECTION (DECL, RELOC)) \ + prefix = ".gnu.linkonce.r."; \ + else \ + prefix = ".gnu.linkonce.d."; \ + \ + len = strlen (name) + strlen (prefix); \ + string = alloca (len + 1); \ + sprintf (string, "%s%s", prefix, name); \ + \ + DECL_SECTION_NAME (DECL) = build_string (len, string); \ +} while (0) +/* A C statement (sans semicolon) to output an element in the table of + global constructors. */ +#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ + do { \ + ctors_section (); \ + fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ + assemble_name (FILE, NAME); \ + fprintf (FILE, "\n"); \ + } while (0) + +/* A C statement (sans semicolon) to output an element in the table of + global destructors. */ +#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ + do { \ + dtors_section (); \ + fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ + assemble_name (FILE, NAME); \ + fprintf (FILE, "\n"); \ + } while (0) + +/* A C statement or statements to switch to the appropriate + section for output of DECL. DECL is either a `VAR_DECL' node + or a constant of some sort. RELOC indicates whether forming + the initial value of DECL requires link-time relocations. */ + +#define SELECT_SECTION(DECL,RELOC) \ +{ \ + if (TREE_CODE (DECL) == STRING_CST) \ + { \ + if (! flag_writable_strings) \ + const_section (); \ + else \ + data_section (); \ + } \ + else if (TREE_CODE (DECL) == VAR_DECL) \ + { \ + if ((flag_pic && RELOC) \ + || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \ + || !DECL_INITIAL (DECL) \ + || (DECL_INITIAL (DECL) != error_mark_node \ + && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \ + data_section (); \ + else \ + const_section (); \ + } \ + else \ + const_section (); \ +} + +/* A C statement or statements to switch to the appropriate + section for output of RTX in mode MODE. RTX is some kind + of constant in RTL. The argument MODE is redundant except + in the case of a `const_int' rtx. Currently, these always + go into the const section. */ + +#undef SELECT_RTX_SECTION +#define SELECT_RTX_SECTION(MODE,RTX) const_section() + +/* Define the strings used for the special svr4 .type and .size directives. + These strings generally do not vary from one system running svr4 to + another, but if a given system (e.g. m88k running svr) needs to use + different pseudo-op names for these, they may be overridden in the + file which includes this one. */ + +#define TYPE_ASM_OP ".type" +#define SIZE_ASM_OP ".size" + +/* This is how we tell the assembler that a symbol is weak. */ + +#define ASM_WEAKEN_LABEL(FILE,NAME) \ + do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ + fputc ('\n', FILE); } while (0) + +/* The following macro defines the format used to output the second + operand of the .type assembler directive. Different svr4 assemblers + expect various different forms for this operand. The one given here + is just a default. You may need to override it in your machine- + specific tm.h file (depending upon the particulars of your assembler). */ + +#define TYPE_OPERAND_FMT "@%s" + +/* Write the extra assembler code needed to declare a function's result. + Most svr4 assemblers don't require any special declaration of the + result value, but there are exceptions. */ + +#ifndef ASM_DECLARE_RESULT +#define ASM_DECLARE_RESULT(FILE, RESULT) +#endif + +/* These macros generate the special .type and .size directives which + are used to set the corresponding fields of the linker symbol table + entries in an ELF object file under SVR4. These macros also output + the starting labels for the relevant functions/objects. */ + +/* Write the extra assembler code needed to declare a function properly. + Some svr4 assemblers need to also have something extra said about the + function's return value. We allow for that here. */ + +#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ + do { \ + fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ + assemble_name (FILE, NAME); \ + putc (',', FILE); \ + fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ + putc ('\n', FILE); \ + ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ + ASM_OUTPUT_LABEL(FILE, NAME); \ + } while (0) + +/* Write the extra assembler code needed to declare an object properly. */ + +#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ + do { \ + fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ + assemble_name (FILE, NAME); \ + putc (',', FILE); \ + fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ + putc ('\n', FILE); \ + size_directive_output = 0; \ + if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ + { \ + size_directive_output = 1; \ + fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ + assemble_name (FILE, NAME); \ + fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ + } \ + ASM_OUTPUT_LABEL(FILE, NAME); \ + } while (0) + +/* Output the size directive for a decl in rest_of_decl_compilation + in the case where we did not do so before the initializer. + Once we find the error_mark_node, we know that the value of + size_directive_output was set + by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ + +#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ +do { \ + char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ + && ! AT_END && TOP_LEVEL \ + && DECL_INITIAL (DECL) == error_mark_node \ + && !size_directive_output) \ + { \ + size_directive_output = 1; \ + fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ + assemble_name (FILE, name); \ + fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ + } \ + } while (0) + +/* This is how to declare the size of a function. */ + +#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ + do { \ + if (!flag_inhibit_size_directive) \ + { \ + char label[256]; \ + static int labelno; \ + labelno++; \ + ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \ + ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \ + fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ + assemble_name (FILE, (FNAME)); \ + fprintf (FILE, ","); \ + assemble_name (FILE, label); \ + fprintf (FILE, "-"); \ + assemble_name (FILE, (FNAME)); \ + putc ('\n', FILE); \ + } \ + } while (0) + +/* A table of bytes codes used by the ASM_OUTPUT_ASCII and + ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table + corresponds to a particular byte value [0..255]. For any + given byte value, if the value in the corresponding table + position is zero, the given character can be output directly. + If the table value is 1, the byte must be output as a \ooo + octal escape. If the tables value is anything else, then the + byte value should be output as a \ followed by the value + in the table. Note that we can use standard UN*X escape + sequences for many control characters, but we don't use + \a to represent BEL because some svr4 assemblers (e.g. on + the i386) don't know about that. Also, we don't use \v + since some versions of gas, such as 2.2 did not accept it. */ + +#define ESCAPES \ +"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ +\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ +\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\ +\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\ +\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ +\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ +\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ +\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1" + +/* Some svr4 assemblers have a limit on the number of characters which + can appear in the operand of a .string directive. If your assembler + has such a limitation, you should define STRING_LIMIT to reflect that + limit. Note that at least some svr4 assemblers have a limit on the + actual number of bytes in the double-quoted string, and that they + count each character in an escape sequence as one byte. Thus, an + escape sequence like \377 would count as four bytes. + + If your target assembler doesn't support the .string directive, you + should define this to zero. +*/ + +#define STRING_LIMIT ((unsigned) 256) + +#define STRING_ASM_OP ".string" + +/* The routine used to output NUL terminated strings. We use a special + version of this for most svr4 targets because doing so makes the + generated assembly code more compact (and thus faster to assemble) + as well as more readable, especially for targets like the i386 + (where the only alternative is to output character sequences as + comma separated lists of numbers). */ + +#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \ + do \ + { \ + register unsigned char *_limited_str = (unsigned char *) (STR); \ + register unsigned ch; \ + fprintf ((FILE), "\t%s\t\"", STRING_ASM_OP); \ + for (; ch = *_limited_str; _limited_str++) \ + { \ + register int escape; \ + switch (escape = ESCAPES[ch]) \ + { \ + case 0: \ + putc (ch, (FILE)); \ + break; \ + case 1: \ + fprintf ((FILE), "\\%03o", ch); \ + break; \ + default: \ + putc ('\\', (FILE)); \ + putc (escape, (FILE)); \ + break; \ + } \ + } \ + fprintf ((FILE), "\"\n"); \ + } \ + while (0) + +/* The routine used to output sequences of byte values. We use a special + version of this for most svr4 targets because doing so makes the + generated assembly code more compact (and thus faster to assemble) + as well as more readable. Note that if we find subparts of the + character sequence which end with NUL (and which are shorter than + STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */ + +#undef ASM_OUTPUT_ASCII +#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ + do \ + { \ + register unsigned char *_ascii_bytes = (unsigned char *) (STR); \ + register unsigned char *limit = _ascii_bytes + (LENGTH); \ + register unsigned bytes_in_chunk = 0; \ + for (; _ascii_bytes < limit; _ascii_bytes++) \ + { \ + register unsigned char *p; \ + if (bytes_in_chunk >= 60) \ + { \ + fprintf ((FILE), "\"\n"); \ + bytes_in_chunk = 0; \ + } \ + for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \ + continue; \ + if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \ + { \ + if (bytes_in_chunk > 0) \ + { \ + fprintf ((FILE), "\"\n"); \ + bytes_in_chunk = 0; \ + } \ + ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \ + _ascii_bytes = p; \ + } \ + else \ + { \ + register int escape; \ + register unsigned ch; \ + if (bytes_in_chunk == 0) \ + fprintf ((FILE), "\t%s\t\"", ASCII_DATA_ASM_OP); \ + switch (escape = ESCAPES[ch = *_ascii_bytes]) \ + { \ + case 0: \ + putc (ch, (FILE)); \ + bytes_in_chunk++; \ + break; \ + case 1: \ + fprintf ((FILE), "\\%03o", ch); \ + bytes_in_chunk += 4; \ + break; \ + default: \ + putc ('\\', (FILE)); \ + putc (escape, (FILE)); \ + bytes_in_chunk += 2; \ + break; \ + } \ + } \ + } \ + if (bytes_in_chunk > 0) \ + fprintf ((FILE), "\"\n"); \ + } \ + while (0) + +/* All SVR4 targets use the ELF object file format. */ +#define OBJECT_FORMAT_ELF diff --git a/gcc/config/m68k/m68020-elf.h b/gcc/config/m68k/m68020-elf.h new file mode 100644 index 00000000000..ac9ae43120c --- /dev/null +++ b/gcc/config/m68k/m68020-elf.h @@ -0,0 +1,42 @@ +/* Definitions of target machine for GNU compiler. "naked" 68020, + elf object files and debugging, version. + Copyright (C) 1987, 1988, 1992, 1995, 1996 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* This comment is here to see if it will keep Sun's cpp from dying. */ + +#include "m68k/m68k-none.h" +#include "m68k/m68kelf.h" +#include "elfos.h" +/* m68k/m68kemb.h sets some macros in ways that override the svr4 abi. */ +#include "m68k/m68kemb.h" + +/* We need to override the default specs from elfos.h. This suppresses the + loading of crt0.o by gcc's default linker spec. For embedded targets crt0 + now comes from the linker script. */ + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "crtbegin.o%s" + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC "crtend.o%s" + +#define LIB_SPEC "-lc" + +/* end of m68020-elf.h */ diff --git a/gcc/config/m68k/m68kelf.h b/gcc/config/m68k/m68kelf.h new file mode 100644 index 00000000000..25f2c383c0a --- /dev/null +++ b/gcc/config/m68k/m68kelf.h @@ -0,0 +1,266 @@ +/* m68kelf support, derived from m68kv4.h */ + +/* Target definitions for GNU compiler for mc680x0 running System V.4 + Copyright (C) 1991, 1993 Free Software Foundation, Inc. + + Written by Ron Guilmette (rfg@netcom.com) and Fred Fish (fnf@cygnus.com). + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* #notinclude "m68k/sgs.h" /* The m68k/SVR4 assembler is SGS based */ + +/* These are necessary for -fpic/-fPIC to work correctly. */ +#ifndef MOTOROLA +#define MOTOROLA /* Use MOTOROLA syntax. */ +#endif +#ifdef USE_GAS /* when present, forces jsbr instead of jsr. */ +#undef USE_GAS +#endif + +#ifndef SWBEG_ASM_OP +#define SWBEG_ASM_OP ".swbeg" +#endif + +/* Here are four prefixes that are used by asm_fprintf to + facilitate customization for alternate assembler syntaxes. + Machines with no likelihood of an alternate syntax need not + define these and need not use asm_fprintf. */ + +/* The prefix for register names. Note that REGISTER_NAMES + is supposed to include this prefix. Also note that this is NOT an + fprintf format string, it is a literal string */ + +#undef REGISTER_PREFIX +#define REGISTER_PREFIX "%" + +/* The prefix for local (compiler generated) labels. + These labels will not appear in the symbol table. */ + +#undef LOCAL_LABEL_PREFIX +#define LOCAL_LABEL_PREFIX "." + +/* The prefix to add to user-visible assembler symbols. */ + +#undef USER_LABEL_PREFIX +#define USER_LABEL_PREFIX "" + +/* The prefix for immediate operands. */ + +#undef IMMEDIATE_PREFIX +#define IMMEDIATE_PREFIX "#" + +/* In the machine description we can't use %R, because it will not be seen + by ASM_FPRINTF. (Isn't that a design bug?). */ + +#undef REGISTER_PREFIX_MD +#define REGISTER_PREFIX_MD "%%" + +/* config/m68k.md has an explicit reference to the program counter, + prefix this by the register prefix. */ + +#define ASM_RETURN_CASE_JUMP return "jmp %%pc@(2,%0:w)" + +/* How to refer to registers in assembler output. + This sequence is indexed by compiler's hard-register-number. + Motorola format uses different register names than defined + in m68k.h. */ + +#undef REGISTER_NAMES + +#define REGISTER_NAMES \ +{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \ + "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \ + "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7" } + +/* This is how to output an assembler line that says to advance the + location counter to a multiple of 2**LOG bytes. */ + +#undef ASM_OUTPUT_ALIGN +#define ASM_OUTPUT_ALIGN(FILE,LOG) \ + if ((LOG) > 0) \ + fprintf ((FILE), "\t%s \t%u\n", ALIGN_ASM_OP, 1 << (LOG)); \ + else if ((LOG) > 31) \ + abort (); + +/* Use proper assembler syntax for these macros. */ +#undef ASM_OUTPUT_REG_PUSH +#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \ + asm_fprintf (FILE, "\t%Omove.l %s,-(%Rsp)\n", reg_names[REGNO]) + +#undef ASM_OUTPUT_REG_POP +#define ASM_OUTPUT_REG_POP(FILE,REGNO) \ + asm_fprintf (FILE, "\t%Omove.l (%Rsp)+,%s\n", reg_names[REGNO]) + +/* Override the definition of NO_DOLLAR_IN_LABEL in svr4.h, for special + g++ assembler names. When this is defined, g++ uses embedded '.' + characters and some m68k assemblers have problems with this. The + chances are much greater that any particular assembler will permit + embedded '$' characters. */ + +#undef NO_DOLLAR_IN_LABEL + +/* Define PCC_STATIC_STRUCT_RETURN if the convention on the target machine + is to use the nonreentrant technique for returning structure and union + values, as commonly implemented by the AT&T Portable C Compiler (PCC). + When defined, the gcc option -fpcc-struct-return can be used to cause + this form to be generated. When undefined, the option does nothing. + For m68k SVR4, the convention is to use a reentrant technique compatible + with the gcc default, so override the definition of this macro in m68k.h */ + +#undef PCC_STATIC_STRUCT_RETURN + +/* Local common symbols are declared to the assembler with ".lcomm" rather + than ".bss", so override the definition in svr4.h */ + +#undef BSS_ASM_OP +#define BSS_ASM_OP ".lcomm" + +/* Register in which address to store a structure value is passed to a + function. The default in m68k.h is a1. For m68k/SVR4 it is a0. */ + +#undef STRUCT_VALUE_REGNUM +#define STRUCT_VALUE_REGNUM 8 + +#define ASM_COMMENT_START "|" + +#undef TYPE_OPERAND_FMT +#define TYPE_OPERAND_FMT "@%s" + +/* Define how the m68k registers should be numbered for Dwarf output. + The numbering provided here should be compatible with the native + SVR4 SDB debugger in the m68k/SVR4 reference port, where d0-d7 + are 0-7, a0-a8 are 8-15, and fp0-fp7 are 16-23. */ + +#undef DBX_REGISTER_NUMBER +#define DBX_REGISTER_NUMBER(REGNO) (REGNO) + +/* The ASM_OUTPUT_SKIP macro is first defined in m68k.h, using ".skip". + It is then overridden by m68k/sgs.h to use ".space", and again by svr4.h + to use ".zero". The m68k/SVR4 assembler uses ".space", so repeat the + definition from m68k/sgs.h here. Note that ASM_NO_SKIP_IN_TEXT is + defined in m68k/sgs.h, so we don't have to repeat it here. */ + +#undef ASM_OUTPUT_SKIP +#define ASM_OUTPUT_SKIP(FILE,SIZE) \ + fprintf (FILE, "\t%s %u\n", SPACE_ASM_OP, (SIZE)) + +#if 0 +/* SVR4 m68k assembler is bitching on the `comm i,1,1' which askes for + 1 byte alignment. Don't generate alignment for COMMON seems to be + safer until we the assembler is fixed. */ +#undef ASM_OUTPUT_ALIGNED_COMMON +/* Same problem with this one. */ +#undef ASM_OUTPUT_ALIGNED_LOCAL +#endif + +/* The `string' directive on m68k svr4 does not handle string with + escape char (ie., `\') right. Use normal way to output ASCII bytes + seems to be safer. */ +#undef ASM_OUTPUT_ASCII +#define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \ +do { \ + register int sp = 0, lp = 0, ch; \ + fprintf ((FILE), "\t%s ", BYTE_ASM_OP); \ + do { \ + ch = (PTR)[sp]; \ + if (ch > ' ' && ! (ch & 0x80) && ch != '\\') \ + { \ + fprintf ((FILE), "'%c", ch); \ + } \ + else \ + { \ + fprintf ((FILE), "0x%x", ch); \ + } \ + if (++sp < (LEN)) \ + { \ + if ((sp % 10) == 0) \ + { \ + fprintf ((FILE), "\n\t%s ", BYTE_ASM_OP); \ + } \ + else \ + { \ + putc (',', (FILE)); \ + } \ + } \ + } while (sp < (LEN)); \ + putc ('\n', (FILE)); \ +} while (0) + +/* SVR4 m68k assembler is bitching on the syntax `2.b'. + So use the "LLDnnn-LLnnn" format. Define LLDnnn after the table. */ + +#undef ASM_OUTPUT_CASE_END +#define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE) \ +do { \ + if (switch_table_difference_label_flag) \ + asm_fprintf ((FILE), "\t%s %LLD%d,%LL%d\n", SET_ASM_OP, (NUM), (NUM));\ + switch_table_difference_label_flag = 0; \ +} while (0) + +extern int switch_table_difference_label_flag; + +#undef ASM_OUTPUT_COMMON +#undef ASM_OUTPUT_LOCAL +#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ +( fputs (".comm ", (FILE)), \ + assemble_name ((FILE), (NAME)), \ + fprintf ((FILE), ",%u\n", (SIZE))) + +#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ +( fputs (".lcomm ", (FILE)), \ + assemble_name ((FILE), (NAME)), \ + fprintf ((FILE), ",%u\n", (SIZE))) + +/* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to + keep switch tables in the text section. */ + +#define JUMP_TABLES_IN_TEXT_SECTION 1 + +/* Override the definition in svr4.h. In m68k svr4, using swbeg is the + standard way to do switch table. */ +#undef ASM_OUTPUT_BEFORE_CASE_LABEL +#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \ + fprintf ((FILE), "\t%s &%d\n", SWBEG_ASM_OP, XVECLEN (PATTERN (TABLE), 1)); + +/* In m68k svr4, a symbol_ref rtx can be a valid PIC operand if it is an + operand of a function call. */ +#undef LEGITIMATE_PIC_OPERAND_P +#define LEGITIMATE_PIC_OPERAND_P(X) \ + (! symbolic_operand (X, VOIDmode) \ + || ((GET_CODE(X) == SYMBOL_REF) && SYMBOL_REF_FLAG(X))) + +/* Turn off function cse if we are doing PIC. We always want function call + to be done as `bsr foo@PLTPC', so it will force the assembler to create + the PLT entry for `foo'. Doing function cse will cause the address of `foo' + to be loaded into a register, which is exactly what we want to avoid when + we are doing PIC on svr4 m68k. */ +#undef OVERRIDE_OPTIONS +#define OVERRIDE_OPTIONS \ +{ \ + if (flag_pic) flag_no_function_cse = 1; \ + if (! TARGET_68020 && flag_pic == 2) \ + error("-fPIC is not currently supported on the 68000 or 68010\n"); \ +} +/* end of stuff from m68kv4.h */ + +#undef SGS_CMP_ORDER + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC "crtend.o%s" + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "crtbegin.o%s" diff --git a/gcc/config/m68k/t-m68kelf b/gcc/config/m68k/t-m68kelf new file mode 100644 index 00000000000..7bdac3c6dc3 --- /dev/null +++ b/gcc/config/m68k/t-m68kelf @@ -0,0 +1,29 @@ +CROSS_LIBGCC1 = libgcc1-asm.a +LIB1ASMSRC = m68k/lb1sf68.asm +LIB1ASMFUNCS = _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \ + _double _float _floatex \ + _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \ + _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2 + +# These are really part of libgcc1, but this will cause them to be +# built correctly, so... +LIB2FUNCS_EXTRA = fpgnulib.c xfgnulib.c + +fpgnulib.c: $(srcdir)/config/m68k/fpgnulib.c + cp $(srcdir)/config/m68k/fpgnulib.c fpgnulib.c +xfgnulib.c: $(srcdir)/config/m68k/fpgnulib.c + echo '#define EXTFLOAT' > xfgnulib.c + cat $(srcdir)/config/m68k/fpgnulib.c >> xfgnulib.c + +MULTILIB_OPTIONS = m68000/m68020/m5200 m68881/msoft-float +MULTILIB_DIRNAMES = +MULTILIB_MATCHES = m68000=mc68000 m68000=m68302 m68000=m68332 m68020=mc68020 m68020=m68040 +MULTILIB_EXCEPTIONS = *m5200/*m68881 *m5200/*msoft-float + +LIBGCC = stmp-multilib +INSTALL_LIBGCC = install-multilib + +# from ../t-svr4 +EXTRA_PARTS=crtbegin.o crtend.o +# no pic for now +#CRTSTUFF_T_CFLAGS=-fpic diff --git a/gcc/graph.c b/gcc/graph.c new file mode 100644 index 00000000000..a60cd42db43 --- /dev/null +++ b/gcc/graph.c @@ -0,0 +1,486 @@ +/* Output routines for graphical representation. + Copyright (C) 1998 Free Software Foundation, Inc. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. + + This file is part of GNU CC. + + GNU CC is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GNU CC is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNU CC; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <config.h> +#include "system.h" + +#include "rtl.h" +#include "flags.h" +#include "output.h" +#include "hard-reg-set.h" +#include "basic-block.h" +#include "toplev.h" + +static const char *graph_ext[] = +{ + /* no_graph */ "", + /* vcg */ ".vcg", +}; + +/* Output text for new basic block. */ +static void +start_fct (fp) + FILE *fp; +{ + + switch (graph_dump_format) + { + case vcg: + fprintf (fp, "\ +graph: { title: \"%s\"\nfolding: 1\nhidden: 2\nnode: { title: \"%s.0\" }\n", + current_function_name, current_function_name); + break; + case no_graph: + break; + } +} + +static void +start_bb (fp, bb) + FILE *fp; + int bb; +{ + switch (graph_dump_format) + { + case vcg: + fprintf (fp, "\ +graph: {\ntitle: \"%s.BB%d\"\nfolding: 1\ncolor: lightblue\n\ +label: \"basic block %d", + current_function_name, bb, bb); + break; + case no_graph: + break; + } + +#if 0 + /* FIXME Should this be printed? It makes the graph significantly larger. */ + + /* Print the live-at-start register list. */ + fputc ('\n', fp); + EXECUTE_IF_SET_IN_REG_SET (basic_block_live_at_start[bb], 0, i, + { + fprintf (fp, " %d", i); + if (i < FIRST_PSEUDO_REGISTER) + fprintf (fp, " [%s]", + reg_names[i]); + }); +#endif + + switch (graph_dump_format) + { + case vcg: + fputs ("\"\n\n", fp); + break; + case no_graph: + break; + } +} + +static int +node_data (fp, tmp_rtx) + FILE *fp; + rtx tmp_rtx; +{ + int result; + + if (PREV_INSN (tmp_rtx) == 0) + { + /* This is the first instruction. Add an edge from the starting + block. */ + switch (graph_dump_format) + { + case vcg: + fprintf (fp, "\ +edge: { sourcename: \"%s.0\" targetname: \"%s.%d\" }\n", + current_function_name, + current_function_name, XINT (tmp_rtx, 0)); + break; + case no_graph: + break; + } + } + + switch (graph_dump_format) + { + case vcg: + fprintf (fp, "node: {\n title: \"%s.%d\"\n color: %s\n \ +label: \"%s %d\n", + current_function_name, XINT (tmp_rtx, 0), + GET_CODE (tmp_rtx) == NOTE ? "lightgrey" + : GET_CODE (tmp_rtx) == INSN ? "green" + : GET_CODE (tmp_rtx) == JUMP_INSN ? "darkgreen" + : GET_CODE (tmp_rtx) == CALL_INSN ? "darkgreen" + : GET_CODE (tmp_rtx) == CODE_LABEL ? "\ +darkgrey\n shape: ellipse" : "white", + GET_RTX_NAME (GET_CODE (tmp_rtx)), XINT (tmp_rtx, 0)); + break; + case no_graph: + break; + } + + /* Print the RTL. */ + if (GET_CODE (tmp_rtx) == NOTE) + { + static const char *note_names[] = + { + NULL, + "deleted", + "block_beg", + "block_end", + "loop_beg", + "loop_end", + "function_end", + "setjmp", + "loop_cont", + "loop_vtop", + "prologue_end", + "epilogue_beg", + "deleted_label", + "function_beg", + "eh_region_beg", + "eh_region_end", + "repeated_line_number", + "range_start", + "range_end", + "live" + }; + + fprintf (fp, " %s", + XINT (tmp_rtx, 4) < 0 ? note_names[-XINT (tmp_rtx, 4)] : ""); + } + else if (GET_RTX_CLASS (GET_CODE (tmp_rtx)) == 'i') + result = print_rtl_single (fp, PATTERN (tmp_rtx)); + else + result = print_rtl_single (fp, tmp_rtx); + + switch (graph_dump_format) + { + case vcg: + fputs ("\"\n}\n", fp); + break; + case no_graph: + break; + } + + return result; +} + +static void +draw_edge (fp, from, to, bb_edge, class) + FILE *fp; + int from; + int to; + int bb_edge; + int class; +{ + switch (graph_dump_format) + { + case vcg: + fprintf (fp, + "edge: { sourcename: \"%s.%d\" targetname: \"%s.%d\" %s", + current_function_name, from, + current_function_name, to, + bb_edge ? "color: blue " : class ? "color: red " : ""); + if (class) + fprintf (fp, "class: %d ", class); + fputs ("}\n", fp); + break; + case no_graph: + break; + } +} + +static void +end_bb (fp, bb) + FILE *fp; + int bb ATTRIBUTE_UNUSED; +{ + switch (graph_dump_format) + { + case vcg: + fputs ("}\n", fp); + break; + case no_graph: + break; + } +} + +static void +end_fct (fp) + FILE *fp; +{ + switch (graph_dump_format) + { + case vcg: + fprintf (fp, "node: { title: \"%s.999999\" label: \"END\" }\n}\n", + current_function_name); + break; + case no_graph: + break; + } +} + +/* Like print_rtl, but also print out live information for the start of each + basic block. */ +void +print_rtl_graph_with_bb (base, suffix, rtx_first) + const char *base; + const char *suffix; + rtx rtx_first; +{ + register rtx tmp_rtx; + size_t namelen = strlen (base); + size_t suffixlen = strlen (suffix); + size_t extlen = strlen (graph_ext[graph_dump_format]) + 1; + char *buf = (char *) alloca (namelen + suffixlen + extlen); + FILE *fp; + + /* Regenerate the basic block information. */ + find_basic_blocks (rtx_first, max_reg_num (), NULL); + + memcpy (buf, base, namelen); + memcpy (buf + namelen, suffix, suffixlen); + memcpy (buf + namelen + suffixlen, graph_ext[graph_dump_format], extlen); + + fp = fopen (buf, "a"); + if (fp == NULL) + return; + + if (rtx_first == 0) + fprintf (fp, "(nil)\n"); + else + { + int i, bb; + enum bb_state { NOT_IN_BB, IN_ONE_BB, IN_MULTIPLE_BB }; + int max_uid = get_max_uid (); + int *start = (int *) alloca (max_uid * sizeof (int)); + int *end = (int *) alloca (max_uid * sizeof (int)); + enum bb_state *in_bb_p = (enum bb_state *) + alloca (max_uid * sizeof (enum bb_state)); + /* Element I is a list of I's predecessors/successors. */ + int_list_ptr *s_preds; + int_list_ptr *s_succs; + /* Element I is the number of predecessors/successors of basic + block I. */ + int *num_preds; + int *num_succs; + + for (i = 0; i < max_uid; ++i) + { + start[i] = end[i] = -1; + in_bb_p[i] = NOT_IN_BB; + } + + for (i = n_basic_blocks - 1; i >= 0; --i) + { + rtx x; + start[INSN_UID (basic_block_head[i])] = i; + end[INSN_UID (basic_block_end[i])] = i; + for (x = basic_block_head[i]; x != NULL_RTX; x = NEXT_INSN (x)) + { + in_bb_p[INSN_UID (x)] + = (in_bb_p[INSN_UID (x)] == NOT_IN_BB) + ? IN_ONE_BB : IN_MULTIPLE_BB; + if (x == basic_block_end[i]) + break; + } + } + + /* Get the information about the basic blocks predecessors and + successors. */ + s_preds = (int_list_ptr *) alloca (n_basic_blocks + * sizeof (int_list_ptr)); + s_succs = (int_list_ptr *) alloca (n_basic_blocks + * sizeof (int_list_ptr)); + num_preds = (int *) alloca (n_basic_blocks * sizeof (int)); + num_succs = (int *) alloca (n_basic_blocks * sizeof (int)); + compute_preds_succs (s_preds, s_succs, num_preds, num_succs); + + /* Tell print-rtl that we want graph output. */ + dump_for_graph = 1; + + /* Start new function. */ + start_fct (fp); + + for (tmp_rtx = NEXT_INSN (rtx_first); NULL != tmp_rtx; + tmp_rtx = NEXT_INSN (tmp_rtx)) + { + int did_output; + int edge_printed = 0; + rtx next_insn; + + if (start[INSN_UID (tmp_rtx)] < 0 && end[INSN_UID (tmp_rtx)] < 0) + { + if (GET_CODE (tmp_rtx) == BARRIER) + continue; + if (GET_CODE (tmp_rtx) == NOTE + && (1 || in_bb_p[INSN_UID (tmp_rtx)] == NOT_IN_BB)) + continue; + } + + if ((bb = start[INSN_UID (tmp_rtx)]) >= 0) + { + /* We start a subgraph for each basic block. */ + start_bb (fp, bb); + + if (bb == 0) + draw_edge (fp, 0, INSN_UID (tmp_rtx), 1, 0); + } + + /* Print the data for this node. */ + did_output = node_data (fp, tmp_rtx); + next_insn = next_nonnote_insn (tmp_rtx); + + if ((bb = end[INSN_UID (tmp_rtx)]) >= 0) + { + int_list_ptr p; + + /* End of the basic block. */ + end_bb (fp, bb); + + /* Now specify the edges to all the successors of this + basic block. */ + for (p = s_succs[bb]; p != NULL; p = p->next) + { + int bb_succ = INT_LIST_VAL (p); + + if (bb_succ >= 0) + { + rtx block_head = BLOCK_HEAD (bb_succ); + + draw_edge (fp, INSN_UID (tmp_rtx), + INSN_UID (block_head), + next_insn != block_head, 0); + + if (BLOCK_HEAD (bb_succ) == next_insn) + edge_printed = 1; + } + else if (bb_succ == EXIT_BLOCK) + { + draw_edge (fp, INSN_UID (tmp_rtx), 999999, + next_insn != 0, 0); + + if (next_insn == 0) + edge_printed = 1; + } + else + abort (); + } + } + + if (!edge_printed) + { + /* Don't print edges to barriers. */ + if (next_insn == 0 + || GET_CODE (next_insn) != BARRIER) + draw_edge (fp, XINT (tmp_rtx, 0), + next_insn ? INSN_UID (next_insn) : 999999, 0, 0); + else + { + /* We draw the remaining edges in class 2. We have + to skip oevr the barrier since these nodes are + not printed at all. */ + do + next_insn = NEXT_INSN (next_insn); + while (next_insn + && (GET_CODE (next_insn) == NOTE + || GET_CODE (next_insn) == BARRIER)); + + draw_edge (fp, XINT (tmp_rtx, 0), + next_insn ? INSN_UID (next_insn) : 999999, 0, 2); + } + } + } + + dump_for_graph = 0; + + end_fct (fp); + } + + fclose (fp); +} + + +/* Similar as clean_dump_file, but this time for graph output files. */ +void +clean_graph_dump_file (base, suffix) + const char *base; + const char *suffix; +{ + size_t namelen = strlen (base); + size_t suffixlen = strlen (suffix); + size_t extlen = strlen (graph_ext[graph_dump_format]) + 1; + char *buf = (char *) alloca (namelen + extlen + suffixlen); + FILE *fp; + + memcpy (buf, base, namelen); + memcpy (buf + namelen, suffix, suffixlen); + memcpy (buf + namelen + suffixlen, graph_ext[graph_dump_format], extlen); + + fp = fopen (buf, "w"); + + if (fp == NULL) + pfatal_with_name (buf); + + switch (graph_dump_format) + { + case vcg: + fputs ("graph: {\nport_sharing: no\n", fp); + break; + case no_graph: + abort (); + } + + fclose (fp); +} + + +/* Do final work on the graph output file. */ +void +finish_graph_dump_file (base, suffix) + const char *base; + const char *suffix; +{ + size_t namelen = strlen (base); + size_t suffixlen = strlen (suffix); + size_t extlen = strlen (graph_ext[graph_dump_format]) + 1; + char *buf = (char *) alloca (namelen + suffixlen + extlen); + FILE *fp; + + memcpy (buf, base, namelen); + memcpy (buf + namelen, suffix, suffixlen); + memcpy (buf + namelen + suffixlen, graph_ext[graph_dump_format], extlen); + + fp = fopen (buf, "a"); + if (fp != NULL) + { + switch (graph_dump_format) + { + case vcg: + fputs ("}\n", fp); + break; + case no_graph: + abort (); + } + + fclose (fp); + } +} diff --git a/gcc/objc/lang-specs.h b/gcc/objc/lang-specs.h new file mode 100644 index 00000000000..1b33ba1a97b --- /dev/null +++ b/gcc/objc/lang-specs.h @@ -0,0 +1,92 @@ +/* Definitions for specs for Objective-C. + Copyright (C) 1998 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* This is the contribution to the `default_compilers' array in gcc.c for + objc. */ + + {".m", {"@objective-c"}}, + {"@objective-c", +#if USE_CPPLIB + {"%{E|M|MM:cpp -lang-objc %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\ + %{C:%{!E:%eGNU C does not support -C without using -E}}\ + %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ + -undef -D__OBJC__ -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\ + %{ansi:-trigraphs -D__STRICT_ANSI__}\ + %{!undef:%{!ansi:%p} %P} %{trigraphs}\ + %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ + %{traditional} %{ftraditional:-traditional}\ + %{traditional-cpp:-traditional}\ + %{fleading-underscore} %{fno-leading-underscore}\ + %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ + %i %{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}}\n}", + "%{!M:%{!MM:%{!E:cc1obj %i %1 \ + %{nostdinc*} %{A*} %{I*} %{P} %I\ + -undef -D__OBJC__ -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\ + %{!undef:%{!ansi:%p} %P} %{trigraphs}\ + %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ + %{!Q:-quiet} -dumpbase %b.m %{d*} %{m*} %{a*}\ + %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} \ + %{traditional} %{v:-version} %{pg:-p} %{p} %{f*} \ + -lang-objc %{gen-decls} \ + %{aux-info*}\ + %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ + %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\ + %{!S:as %a %Y\ + %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\ + %{!pipe:%g.s} %A\n }}}}"} +#else /* ! USE_CPPLIB */ + {"cpp -lang-objc %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\ + %{C:%{!E:%eGNU C does not support -C without using -E}}\ + %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ + -undef -D__OBJC__ -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\ + %{ansi:-trigraphs -D__STRICT_ANSI__}\ + %{!undef:%{!ansi:%p} %P} %{trigraphs}\ + %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ + %{traditional} %{ftraditional:-traditional}\ + %{traditional-cpp:-traditional}\ + %{fleading-underscore} %{fno-leading-underscore}\ + %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ + %i %{!M:%{!MM:%{!E:%{!pipe:%g.mi}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n", + "%{!M:%{!MM:%{!E:cc1obj %{!pipe:%g.mi} %1 \ + %{!Q:-quiet} -dumpbase %b.m %{d*} %{m*} %{a*}\ + %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} \ + %{traditional} %{v:-version} %{pg:-p} %{p} %{f*} \ + -lang-objc %{gen-decls} \ + %{aux-info*}\ + %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ + %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\ + %{!S:as %a %Y\ + %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\ + %{!pipe:%g.s} %A\n }}}}"} +#endif /* ! USE_CPPLIB */ + }, + {".mi", {"@objc-cpp-output"}}, + {"@objc-cpp-output", + {"%{!M:%{!MM:%{!E:cc1obj %{!pipe:%g.i} %1 \ + %{!Q:-quiet} -dumpbase %b.m %{d*} %{m*} %{a*}\ + %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} \ + %{traditional} %{v:-version} %{pg:-p} %{p} %{f*} \ + -lang-objc %{gen-decls} \ + %{aux-info*}\ + %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ + %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n", + "%{!S:as %a %Y\ + %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\ + %{!pipe:%g.s} %A\n }}}}"}}, diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/13478.C b/gcc/testsuite/g++.old-deja/g++.benjamin/13478.C new file mode 100644 index 00000000000..97256ed7643 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/13478.C @@ -0,0 +1,36 @@ +// 981203 bkoz +// g++/13478 +// Build don't link: + +class A {}; +class AData {}; + +typedef void (A::* hand) (void); + +struct hand_table { + const int data1; + const hand data2; +}; + +class Agent : public A { +public: + enum { first = 1, last }; +protected: + static const hand_table table_1[]; + static const AData table_2; +private: + void foo (void); +}; + +const hand_table Agent::table_1[] = +{ + {0, &Agent::table_2}, + {first, &Agent::foo}, + {last, &(hand)Agent::foo} // ERROR - // ERROR - +}; // ERROR - // ERROR - + + + + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/13523.C b/gcc/testsuite/g++.old-deja/g++.benjamin/13523.C new file mode 100644 index 00000000000..eca71fa2f7b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/13523.C @@ -0,0 +1,12 @@ +// 981203 bkoz +// g++/13523 +// Build don't link: + +template<typename T> class latin_america; + +class peru +{ + friend class latin_america<int>; // Particular template class friend works + template<class T> friend class latin_america; // This does not work. +}; + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/13908.C b/gcc/testsuite/g++.old-deja/g++.benjamin/13908.C new file mode 100644 index 00000000000..403a9988dfd --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/13908.C @@ -0,0 +1,21 @@ +// 981203 bkoz +// g++/13908 +// Build don't link: + +class chile +{ +public: +protected: +private: +}; + +typedef void (chile::* pmf) (); + +void* foo; + +void bar (chile* pobj, pmf pmethod) +{ + //-edg: expected member name + //-g++: taking address of bound pointer-to-member expression + foo = (void*) &(pobj->*pmethod); // ERROR - +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/14139.C b/gcc/testsuite/g++.old-deja/g++.benjamin/14139.C new file mode 100644 index 00000000000..dc0c5695f15 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/14139.C @@ -0,0 +1,22 @@ +// 981203 bkoz +// g++/14309 +// test for global functions, mf's, and templatized mf's. +// Build don't link: + +static int fooe_1(void) { return 5; } +static int fooe_2(int x = fooe_1()) { return x; } + +struct antigua { + static int& foo_1(); + static int foo_2(int& x = antigua::foo_1()); + static int foo_3(int x = fooe_2()); +}; + +template <typename T> + struct jamacia { + static int& foo_1(); + static int foo_2(int& x = antigua::foo_1()); + static int foo_3(int x = fooe_2()); + }; + +template class jamacia<int>; diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/14664-1.C b/gcc/testsuite/g++.old-deja/g++.benjamin/14664-1.C new file mode 100644 index 00000000000..b5dc839f884 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/14664-1.C @@ -0,0 +1,16 @@ +// 981203 bkoz +// g++/14664 - test +// Build don't link: +// Special g++ Options: -fconst-strings + +char foo[26]; + +void bar() +{ + //-g++: incompatible types in assignment of 'const char[]' to 'char[]' + //-edg: expression must be a modifiable lvalue + foo = "0123456789012345678901234"; // ERROR - // ERROR - +} + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/14664-2.C b/gcc/testsuite/g++.old-deja/g++.benjamin/14664-2.C new file mode 100644 index 00000000000..35dc0b2f6ad --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/14664-2.C @@ -0,0 +1,16 @@ +// 981203 bkoz +// g++/14664 + test +// Build don't link: +// Special g++ Options: -fno-const-strings + +char foo[26]; + +void bar() +{ + // the addition of the flag "-fno-const-string-literal" reverts to pre-ISO. + // -g++: ANSI C++ forbids assignment of arrays + foo = "0123456789012345678901234"; // WARNING - +} + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/14687.C b/gcc/testsuite/g++.old-deja/g++.benjamin/14687.C new file mode 100644 index 00000000000..c2a9a99d0c2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/14687.C @@ -0,0 +1,53 @@ +// 981203 bkoz +// g++/14687 +// excess errors test - XFAIL *-*-* + +#include <assert.h> +unsigned int gtest; + +// 7.3.3 the using declaration + +// p 3 +struct belieze { + void f(char); + void g(char); + enum E { e }; + union { int x; }; +}; + +struct dominica: belieze { + using belieze::f; + void f(int i) { f('c'); } // calls belieze::f(char) + void g(int i) { g('c'); } // recursively calls dominca::g(int) +}; + + +// p 6 +namespace A { + void f(int i) { gtest = 1; } +} + +using A::f; //f is a synonym for A::f, that is for A::f(int) + +namespace A { + void f(char c) { gtest = 3; } +} + +void foo(void) { + f('a'); //calls f(int), even though A::f(char) exits + assert (gtest = 1); +} + +void bar(void) { + using A::f; //f is a synonm for A::f, that is for A::f(int) and A::f(char) + f('a'); //calls f(char) + assert (gtest = 3); +} + +int main(void) +{ + foo(); + bar(); + + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15054.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15054.C new file mode 100644 index 00000000000..65688f70a31 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15054.C @@ -0,0 +1,10 @@ +// 981203 bkoz +// g++/15054 +// Build don't link: +// Special g++ Options: -Wno-pointer-arith +// note that -pedantic also turns on this warning + +void cuba(void) { + void* p; + p++; +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15071.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15071.C new file mode 100644 index 00000000000..d05ba8c00dd --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15071.C @@ -0,0 +1,11 @@ +// 981203 bkoz +// g++/15071 +// gcc invocation fails to link in libstdc++ + +#include <iostream.h> + +int main() { + cout<<"hi"<<endl; + + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15309-1.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15309-1.C new file mode 100644 index 00000000000..ec83fb46ae4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15309-1.C @@ -0,0 +1,21 @@ +// 981203 bkoz +// g++/15309 +// Build don't link: +// Special g++ Options: -Wnon-virtual-dtor -Weffc++ + +class bahamian { +public: + bahamian (); + ~bahamian (); +}; + +class miami : public bahamian +{ +public: + miami (); + ~miami (); +}; // WARNING - // WARNING - + + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15309-2.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15309-2.C new file mode 100644 index 00000000000..1b483c869b9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15309-2.C @@ -0,0 +1,10 @@ +// 981203 bkoz +// g++/15309 +// Build don't link: +// Special g++ Options: -Wnon-virtual-dtor -Weffc++ + +class bermuda { +public: + virtual int func1(int); + ~bermuda(); +}; // WARNING - // WARNING - diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15351-1.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15351-1.C new file mode 100644 index 00000000000..755c3608fcb --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15351-1.C @@ -0,0 +1,27 @@ +// 981203 bkoz +// g++/15351 - test +// Special g++ Options: -fno-const-strings + +#include <assert.h> + +bool gtest; + +struct acapulco { + acapulco(const char *) { gtest = false; } + acapulco(char *) { gtest = true; } +}; + +void foo(void) +{ + acapulco("some such string\n"); +} + +int main() +{ + foo(); + if (!gtest) + assert (0); + + return !gtest; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15351-2.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15351-2.C new file mode 100644 index 00000000000..98ecaac29a1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15351-2.C @@ -0,0 +1,27 @@ +// 981203 bkoz +// g++/15351 + test +// Special g++ Options: -fconst-strings + +#include <assert.h> + +bool gtest; + +struct acapulco { + acapulco(const char *) { gtest = true; } + acapulco(char *) { gtest = false; } +}; + +void foo(void) +{ + acapulco("some such string\n"); +} + +int main() +{ + foo(); + if (!gtest) + assert (0); + + return !gtest; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15756-1.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15756-1.C new file mode 100644 index 00000000000..cc44e6a74a0 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15756-1.C @@ -0,0 +1,36 @@ +// 981203 bkoz +// g++/15756 test1 +// Build don't link: +// Special g++ Options: -Wsign-promo + +enum e_value { first = 0, next = 30 }; + +struct sanjuan { + sanjuan(int value); + sanjuan(unsigned value); + friend sanjuan operator&(const sanjuan& x, const sanjuan& y); + friend int operator!=(const sanjuan& x, const sanjuan& y); +}; + +extern void mod_enum(e_value*); +extern int a; + +void foo(void) { + e_value mod = first; + mod_enum(&mod); + if (mod != next) + ++a; +} + + + + + + + + + + + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15756-2.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15756-2.C new file mode 100644 index 00000000000..33c4b23963e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15756-2.C @@ -0,0 +1,44 @@ +// 981203 bkoz +// g++/15756 test2 +// Build don't link: +// Special g++ Options: -Wsign-promo +// this test may only be valid for 32bit targets at present + +enum e_i { + vali +} +enum_int; + +enum e_ui { + valui = 0xF2345678 +} +enum_uint; + +int i; +unsigned int ui; + +struct caracas { + caracas(int); + caracas(unsigned int); + void foo(); +}; + +int main () +{ + caracas obj_ei ( enum_int ); // WARNING - // WARNING - + caracas obj_eui ( enum_uint ); // WARNING - // WARNING - + caracas obj_i ( i ); + caracas obj_ui ( ui ); + + obj_ei.foo(); + obj_eui.foo(); + obj_i.foo(); + obj_ui.foo(); +} + + + + + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15799.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15799.C new file mode 100644 index 00000000000..5309daf8c63 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15799.C @@ -0,0 +1,29 @@ +// 981203 bkoz +// g++/15799 test1 +// Build don't link: + +/* +15799.cpp: In function `void foo()': +15799.cpp:21: call of overloaded `sanjose({anonymous enum})' is ambiguous +15799.cpp:13: candidates are: sanjose::sanjose(const sanjose &) <near match> +15799.cpp:14: sanjose::sanjose(unsigned int) +*/ + +typedef char int_8; +typedef unsigned long uint_32; + +class sanjose { +public: + sanjose(); + sanjose(const sanjose&); + sanjose(int_8 value); // ERROR - // ERROR - + sanjose(uint_32 value); // ERROR - // ERROR - +}; + +enum { first, last}; + +void foo(void) { + sanjose obj(first); // ERROR - // ERROR - +}; + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15800-1.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15800-1.C new file mode 100644 index 00000000000..49aabc9655c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15800-1.C @@ -0,0 +1,17 @@ +// 981203 bkoz +// g++/15800 - test +// Build don't link: + +struct panama { + panama(); + panama(panama &); + panama& operator=(panama&); // ERROR - // ERROR - +}; + +extern panama dig(); + +void foo() { + panama obj; + obj = dig(); // ERROR - // ERROR - +} + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15800-2.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15800-2.C new file mode 100644 index 00000000000..18e299aa44c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15800-2.C @@ -0,0 +1,18 @@ +// 981203 bkoz +// g++/15800 + test +// Build don't link: + +struct panama { + panama(); + panama(panama &); + panama& operator=(panama&); + panama& getref() { return *this; } +}; + +extern panama dig(); + +void foo() { + panama obj; + obj = dig().getref(); +} + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15822.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15822.C new file mode 100644 index 00000000000..ecd93afd869 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15822.C @@ -0,0 +1,27 @@ +// 981203 bkoz +// g++/15822 + +#include <assert.h> + +static unsigned int gcount; + +struct playahermosa { + playahermosa() { ++gcount; } + playahermosa(const playahermosa &) { ++gcount; } + ~playahermosa() { --gcount; } +}; + +struct playacoco { + playacoco(const playahermosa& = playahermosa()) { } //create a temporary +}; + +void foo(playacoco *) { } + +int main() +{ + playacoco bar[2]; + foo(bar); + assert (gcount == 0); + + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/16077.C b/gcc/testsuite/g++.old-deja/g++.benjamin/16077.C new file mode 100644 index 00000000000..f38154ec507 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/16077.C @@ -0,0 +1,28 @@ +// 981203 bkoz +// g++/16077 +// Build don't link: + +class nicaragua; +struct colombia { + colombia(); + colombia(const colombia &); + colombia(const nicaragua &); + colombia &operator= (const colombia&); +}; + +struct nicaragua { +public: + nicaragua(); + nicaragua(const nicaragua&); + operator colombia(); +}; + +void peace(const colombia&); // WARNING - // WARNING - + +void foo(nicaragua& b) { + peace(b); // WARNING - // WARNING - +} + + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/16567.C b/gcc/testsuite/g++.old-deja/g++.benjamin/16567.C new file mode 100644 index 00000000000..8039f5babe6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/16567.C @@ -0,0 +1,44 @@ +// 981203 bkoz +// g++/16567 +// Build don't link: + +typedef bool Bool; +typedef unsigned char Uint8; +typedef unsigned short Uint16; +typedef unsigned int Uint32; + +enum e_ms { third = 3, fourth = 4 }; + +struct bitmask { + Uint8* anon1; + Uint32 anon2; + Uint8 anon3; + Uint8 here: 2; + Uint8 anon4: 2; + Uint8 anon5: 4; +}; + +struct control { + Uint8 foo_1(); +}; + +inline Uint8 foo_2(bitmask* p) { + return p->here; +} + +inline Uint8 control::foo_1() { + return foo_2((bitmask*) this); +} + +void foo(void) { + control obj; + control *fp = &obj; + e_ms result; + + result = (e_ms) fp->foo_1; // ERROR - // ERROR - +} + + + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/17922.C b/gcc/testsuite/g++.old-deja/g++.benjamin/17922.C new file mode 100644 index 00000000000..471709287ef --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/17922.C @@ -0,0 +1,19 @@ +// 981204 bkoz +// g++/17922 +// Build don't link: + +class base { }; + +struct derived : public base { + derived (const derived&); + derived (const base&); +}; + +class tahiti { +public: + static void mf (derived); +}; + +void foo (const derived aaa) { + tahiti::mf(aaa); +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/17930.C b/gcc/testsuite/g++.old-deja/g++.benjamin/17930.C new file mode 100644 index 00000000000..3d7fc65a326 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/17930.C @@ -0,0 +1,6 @@ +// 981204 bkoz +// g++/17930 +// Build don't link: + +char const one[] = "test"; +char const two[] = one; // ERROR - // ERROR - diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/18208.C b/gcc/testsuite/g++.old-deja/g++.benjamin/18208.C new file mode 100644 index 00000000000..7ec1dc09098 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/18208.C @@ -0,0 +1,25 @@ +// 981204 bkoz +// g++/18208 +// Build don't link: + +typedef unsigned int uint_32; + +class puertorico { +public: + void *f (); +private: + uint_32 member; +}; + +void foo( ) +{ + uint_32 ui; + puertorico obj; + + // Bug using static_cast<> + ui = static_cast<uint_32>(obj); // ERROR - // ERROR - + + // Bug when missing the pair of braces + ui = (uint_32) obj.f; // ERROR - // ERROR - +} + diff --git a/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C b/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C new file mode 100644 index 00000000000..9874131a44d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C @@ -0,0 +1,15 @@ +struct A +{ + A(); + A(A&); // ERROR - referenced below +}; + +int +main () +{ + try + { + throw A(); // ERROR - can't copy + } + catch (...) { } +} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/tmpl2.C b/gcc/testsuite/g++.old-deja/g++.eh/tmpl2.C new file mode 100644 index 00000000000..af3dc7bc12a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.eh/tmpl2.C @@ -0,0 +1,33 @@ +// Build don't link: +// Special g++ flags: -O +// crash test - XFAIL i*86-*-linux* + +// Posted by H. J. Lu <hjl@lucon.org> + +template<class T> +class FixSeq +{ +public: + void append(const T&); +}; +class foo +{ +public: + void setupIR(); +}; +typedef FixSeq<foo *> bar; +extern void dummy (foo *); +void * +foobar (bar &x, foo *p) +{ + try + { + p -> setupIR(); + } + catch(...) + { + dummy (p); + } + x.append(p); + return p; +} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/tmpl3.C b/gcc/testsuite/g++.old-deja/g++.eh/tmpl3.C new file mode 100644 index 00000000000..738e7d85825 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.eh/tmpl3.C @@ -0,0 +1,11 @@ +// Build don't link: + +// Posted by Trevor Taylor <ttaylor@powerup.com.au> + +template<class T> struct A { + void X() throw(T); // gets bogus error - previous decl - XFAIL *-*-* +}; + +template<class T> +inline void A<T>::X() +throw(T) { } // gets bogus error - different throws - XFAIL *-*-* diff --git a/gcc/testsuite/g++.old-deja/g++.ns/crash2.C b/gcc/testsuite/g++.old-deja/g++.ns/crash2.C new file mode 100644 index 00000000000..d49189bfbe1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/crash2.C @@ -0,0 +1,12 @@ +// Build don't link: + +// Submitted by bjornw@fairplay.no + +// crash test - XFAIL *-*-* + +namespace hei { + class CSomeClass {}; + extern CSomeClass SomeClass; +}; + +hei::CSomeClass hei::CSomeClass; // ERROR - should be hei::SomeClass diff --git a/gcc/testsuite/g++.old-deja/g++.ns/template7.C b/gcc/testsuite/g++.old-deja/g++.ns/template7.C new file mode 100644 index 00000000000..3c857355a50 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/template7.C @@ -0,0 +1,13 @@ +// Build don't link: + +// crash test - XFAIL *-*-* + +// Based on bug report by Eric NICOLAS <nicolas@bnp-eng.remcomp.com> + +namespace foo { + template<class F> struct bar {}; +} + +void baz() { + foo::bar(); // ERROR - template used as expression +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/using10.C b/gcc/testsuite/g++.old-deja/g++.ns/using10.C new file mode 100644 index 00000000000..cd5cd47627a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/using10.C @@ -0,0 +1,9 @@ +//Build don't link: +//Based on a report by Helmut Jarausch <jarausch@IGPM.Rwth-Aachen.DE> +template<class> +class foo{}; + +namespace ABC +{ + using ::foo; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/using11.C b/gcc/testsuite/g++.old-deja/g++.ns/using11.C new file mode 100644 index 00000000000..23943f22a1a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/using11.C @@ -0,0 +1,9 @@ +// Build don't link: + +class joey { +public: + typedef int SVec; +}; + +using joey::SVec; // ERROR - joey is not a namespace + diff --git a/gcc/testsuite/g++.old-deja/g++.other/copy1.C b/gcc/testsuite/g++.old-deja/g++.other/copy1.C new file mode 100644 index 00000000000..5cc68a5623e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/copy1.C @@ -0,0 +1,25 @@ +// Bug: expand_vec_init doesn't copy arrays of builtin types. + +struct B { + B() { } + B(const B&) { } +}; + +struct A +{ + B b; + int ar[5]; +}; + +int main() +{ + A a; + for (int i = 0; i < 5; ++i) + a.ar[i] = i; + + A a2 = a; + + for (int i = 0; i < 5; ++i) + if (a2.ar[i] != a.ar[i]) + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/debug2.C b/gcc/testsuite/g++.old-deja/g++.other/debug2.C new file mode 100644 index 00000000000..200aeb3cffc --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/debug2.C @@ -0,0 +1,31 @@ +// Build don't link: +// Special g++ Options: -funroll-loops -O2 -g + +inline void f() +{ + typedef int T; +} + +inline void g() +{ + typedef double U; +} + +int n; + +struct B +{ + ~B() { + for (int i = 0; i < n; ++i) + g(); + } +}; + +struct D : public B { + ~D() { + for (int j = 0; j < n; ++j) + f(); + } +}; + +D d; diff --git a/gcc/testsuite/g++.old-deja/g++.other/expr1.C b/gcc/testsuite/g++.old-deja/g++.other/expr1.C new file mode 100644 index 00000000000..0f5fdcf12ee --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/expr1.C @@ -0,0 +1,13 @@ +// Build don't link: + +// crash test - XFAIL *-*-* + +// Simplified from bug report by Trevor Taylor <ttaylor@powerup.com.au> + +struct T { + int operator()(int) { } +}; + +int main() { + T()(); // ERROR - no such operator +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/init11.C b/gcc/testsuite/g++.old-deja/g++.other/init11.C new file mode 100644 index 00000000000..79d7d6caa71 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/init11.C @@ -0,0 +1,38 @@ +// Check that elements for which no explicit initializer was given are +// default-initialized properly. + +extern "C" int printf (const char *, ...); + +struct A +{ + int i; + A(): i (42) { } + A(int j): i(j) { } +}; + +A ar[4] = { 1, 2 }; + +struct B +{ + A a1, a2, a3, a4; +}; + +B b = { 1, 2 }; + +struct C +{ + A ar[4]; +}; + +C c = { 1, 2 }; + +int +main () +{ + printf ("%d %d %d %d\n%d %d %d %d\n%d %d %d %d\n", + ar[0].i, ar[1].i, ar[2].i, ar[3].i, + b.a1.i, b.a2.i, b.a3.i, b.a4.i, + c.ar[1-1].i, c.ar[2-1].i, c.ar[3-1].i, c.ar[4-1].i); + + return (b.a4.i != 42 || c.ar[3].i != 42); +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/lookup5.C b/gcc/testsuite/g++.old-deja/g++.other/lookup5.C new file mode 100644 index 00000000000..9fe04151142 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/lookup5.C @@ -0,0 +1,11 @@ +// Build don't link: +// Simplified from bug report by Paris Smaragdis <paris@media.mit.edu> + +// crash test - XFAIL *-*-* + +template <class T> class vector {}; +class foo {}; +int main() { + foo f; + f.vector(); // ERROR - not a method +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/overload7.C b/gcc/testsuite/g++.old-deja/g++.other/overload7.C new file mode 100644 index 00000000000..57bec8bed2d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/overload7.C @@ -0,0 +1,22 @@ +// Check that object call works when there are multiple conversion ops +// returning the same type. + +typedef int (*pfn)(); + +int zero () { return 0; } +int one () { return 1; } +int two () { return 2; } + +struct A { + A() { } + operator pfn () { return one; } + operator pfn () const { return zero; } + operator pfn () volatile { return two; } +}; + +int +main () +{ + const A a; + return a(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/decl2.C b/gcc/testsuite/g++.old-deja/g++.pt/decl2.C new file mode 100644 index 00000000000..2e2b91cde86 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/decl2.C @@ -0,0 +1,9 @@ +// Build don't link: + +// Simplified from testcase by Christophe Boyanique <boyan@imac.u-paris2.fr> + +// crash test - XFAIL *-*-* + +template <class T> struct foo { foo(); }; +template<class T> foo<T>::foo() {} +T // ERROR - currently an ICE diff --git a/gcc/testsuite/g++.old-deja/g++.pt/defarg8.C b/gcc/testsuite/g++.old-deja/g++.pt/defarg8.C new file mode 100644 index 00000000000..6bb1125259c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/defarg8.C @@ -0,0 +1,14 @@ +// Build don't link: + +// Default arguments containing more than one non-nested explicit +// template argument leads to parse error + +template <class T> class foo1; +template <class T, class U> class foo2; + +struct bar { + template <class T, class U> + bar(int i = foo1<T>::baz, // ok + int j = int(foo2<T, U>::baz), // ok + int k = foo2<T, U>::baz) {} // gets bogus error - before > - XFAIL *-*-* +}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit76.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit76.C new file mode 100644 index 00000000000..18c161c6e27 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit76.C @@ -0,0 +1,11 @@ +// Build don't link: + +// Based on bug report by Simon A. Crase <s.crase@ieee.org> + +// crash test - XFAIL *-*-* + +struct foo { + template <class T> void bar(); +}; + +template void foo::bar<void>(); // gets bogus error - ICE - XFAIL *-*-* diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend37.C b/gcc/testsuite/g++.old-deja/g++.pt/friend37.C new file mode 100644 index 00000000000..2379d5f1da7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/friend37.C @@ -0,0 +1,8 @@ +// Build don't link: +// Simplified from report by Volker Dobler <volker@hugo.physik.uni-konstanz.de> + +// crash test - XFAIL *-*-* + +template <class T> class A { + friend int ice<>( int k=0 ); // ERROR - undeclared +}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend38.C b/gcc/testsuite/g++.old-deja/g++.pt/friend38.C new file mode 100644 index 00000000000..41c7714acc5 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/friend38.C @@ -0,0 +1,10 @@ +// Build don't link: + +// Overly simplified from testcase by "B. K. Oxley" <binkley@bigfoot.com> + +// crash test - XFAIL *-*-* + +template<class P> struct foo { + typedef P parent_type; + friend parent_type; // ERROR - template parameters cannot be friends +}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/instantiate6.C b/gcc/testsuite/g++.old-deja/g++.pt/instantiate6.C new file mode 100644 index 00000000000..e896ed32570 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/instantiate6.C @@ -0,0 +1,26 @@ +// Build then link: +// Special g++ Options: -frepo + +// Simplified from testcase by Erez Louidor Lior <s3824888@techst02.technion.ac.il> +// excess errors test - XFAIL *-*-* + +template <class T> +class foo{ +public: + void g(); + void h(); +}; + +template <class T> +void foo<T>::g() { + h(); +} + +template <class T> +void foo<T>::h() { +} + +int main() { + foo<int> f; + f.g(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/lookup6.C b/gcc/testsuite/g++.old-deja/g++.pt/lookup6.C new file mode 100644 index 00000000000..053110990b9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/lookup6.C @@ -0,0 +1,15 @@ +// Build don't link: + +// Based on bug report by Miniussi <miniussi@ilog.fr> + +class t {}; + +template <class T> struct A { typedef T t; typedef T u; }; + +template <class T> struct B : public A<T> { + // according to [temp.dep.type], `t' and `u' cannot be dependent types, + // and so there's no reason to delay lookup to specialization time. + void f(t p); // this is ::t [temp.dep]/3 + void f(typename A<T>::t p); // gets bogus error - redefinition - XFAIL *-*-* + void g(u p); // ERROR - unknown type name - XFAIL *-*-* +}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memclass18.C b/gcc/testsuite/g++.old-deja/g++.pt/memclass18.C new file mode 100644 index 00000000000..bb7f6f12b99 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/memclass18.C @@ -0,0 +1,9 @@ +// Build don't link: + +template <class T> struct A { + template <class U> struct B; +}; + +template <class T> template <class U> struct A<T>::B { }; + +A<int>::B<int> b; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memclass19.C b/gcc/testsuite/g++.old-deja/g++.pt/memclass19.C new file mode 100644 index 00000000000..6a8b0a7d11c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/memclass19.C @@ -0,0 +1,9 @@ +// Build don't link: + +template <class T> struct A { + template <class U> struct B; +}; + +template <class T> template <class U> struct A<T>::B<U*> { }; + +A<int>::B<int*> b; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp80.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp80.C new file mode 100644 index 00000000000..61a2fb87033 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp80.C @@ -0,0 +1,16 @@ +// Build don't link: + +template<typename T> T baz() { return 0; } + +struct foo { + template<typename T> static T staticbar() { return 0; } + template<typename T> T bar() { return 0; } +}; + +void f() +{ + foo t; + int i = baz<int>(); + int j = foo::staticbar<int>(); + int k = t.bar<int>(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/overload7.C b/gcc/testsuite/g++.old-deja/g++.pt/overload7.C new file mode 100644 index 00000000000..bfd8b5a5eb4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/overload7.C @@ -0,0 +1,20 @@ +// Build don't link: + +// Adapted from testcase by Corey Kosak <kosak@cs.cmu.edu> + +template<class T> +struct moo_t { + struct cow_t {}; +}; + +template<class T> void foo(typename moo_t<T>::cow_t) {} + +template<class T> void foo(moo_t<T>) { + typename moo_t<T>::cow_t p; + foo(p); // gets bogus error - no matching function for call - XFAIL *-*-* +} + +int main() { + moo_t<int> x; + foo(x); // gets bogus error - instantiated from here - XFAIL *-*-* +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/overload8.C b/gcc/testsuite/g++.old-deja/g++.pt/overload8.C new file mode 100644 index 00000000000..9f38a5cb256 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/overload8.C @@ -0,0 +1,12 @@ +// Build don't link: + +// Simplified from bug report by Tim Rowley <tor@cs.brown.edu> + +struct baz; + +void operator*(baz&, double); + +template <class T> inline T operator*(double s, const T &p) + ; // gets bogus error - must have argument of class type - XFAIL *-*-* + +void m(baz& a) { a * .5; } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec25.C b/gcc/testsuite/g++.old-deja/g++.pt/spec25.C new file mode 100644 index 00000000000..884abf07dee --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/spec25.C @@ -0,0 +1,15 @@ +// Build don't link: + +template <class T, int I> +struct S { +}; + +template <int I> +struct S <double, I> { +}; + +template <class T> +void f () +{ + S<double, T::x> s; +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec26.C b/gcc/testsuite/g++.old-deja/g++.pt/spec26.C new file mode 100644 index 00000000000..1bd40b6083c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/spec26.C @@ -0,0 +1,11 @@ +// From: lat@iki.fi (Lassi A. Tuura) +// Test that a specialization without an initializer is not a definition, +// as specified in [temp.expl.spec]. + +// Build don't link: + +struct X; +template <class T> struct Y { static const X array[]; }; +template <> const X Y<int>::array []; +struct X { int i; }; +template <> const X Y<int>::array [] = { 0, 1, 2, 3 }; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/static6.C b/gcc/testsuite/g++.old-deja/g++.pt/static6.C new file mode 100644 index 00000000000..785bc4e1a8c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/static6.C @@ -0,0 +1,14 @@ +// Build don't run: + +// Simplified from testcase by Erez Louidor Lior <s3824888@techst02.technion.ac.il> + +// excess errors test - XFAIL *-*-* + +template <class T> struct A { + static const int l[1]; +}; + +template<class T> +const int A<T>::l[1] = {1}; + +int i = A<int>::l[0]; diff --git a/gcc/testsuite/g77.f-torture/execute/labug1.f b/gcc/testsuite/g77.f-torture/execute/labug1.f new file mode 100644 index 00000000000..032fa41f899 --- /dev/null +++ b/gcc/testsuite/g77.f-torture/execute/labug1.f @@ -0,0 +1,57 @@ + PROGRAM LABUG1 + +* This program core dumps on mips-sgi-irix6.2 when compiled +* with egcs-19981101, egcs-19981109 and egcs-19981122 snapshots +* with -O2 +* +* Originally derived from LAPACK test suite. +* Almost any change allows it to run. +* +* David Billinghurst, (David.Billinghurst@riotinto.com.au) +* 25 November 1998 +* +* .. Parameters .. + INTEGER LDA, LDE + PARAMETER ( LDA = 2500, LDE = 50 ) + COMPLEX CZERO + PARAMETER ( CZERO = ( 0.0E+0, 0.0E+0 ) ) + + INTEGER I, J, M, N + REAL V + COMPLEX A(LDA),B(LDA),C(LDA),E(LDE,LDE),F(LDE,LDE) + COMPLEX Z + + N=2 + M=1 +* + do i = 1, m + do j = 1, n + e(i,j) = czero + f(i,j) = czero + end do + end do +* + DO J = 1, N + DO I = 1, M + V = ABS( E(I,J) - F(I,J) ) + END DO + END DO + + CALL SUB2(M,Z) + + END + + subroutine SUB2(I,A) + integer i + complex a + end + + + + + + + + + + diff --git a/gcc/testsuite/gcc.c-torture/execute/981130-1.c b/gcc/testsuite/gcc.c-torture/execute/981130-1.c new file mode 100644 index 00000000000..72630b07ec8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/981130-1.c @@ -0,0 +1,30 @@ +struct s { int a; int b;}; +struct s s1; +struct s s2 = { 1, 2, }; + +void +check (a, b) + int a; + int b; +{ + if (a == b) + exit (0); + else + abort (); +} + +int +main () +{ + int * p; + int x; + + s1.a = 9; + p = & s1.a; + s1 = s2; + x = * p; + + check (x, 1); +} + + diff --git a/gcc/testsuite/gcc.c-torture/execute/981130-1.x b/gcc/testsuite/gcc.c-torture/execute/981130-1.x new file mode 100644 index 00000000000..1565c68adc7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/981130-1.x @@ -0,0 +1,22 @@ +# This test is known to fail on targets that use the instruction scheduler +# at optimisation levels of 2 or more because the alias analysis is confused +# by the reassignment of a variable structure to a fixed structure. The +# failure could be suppressed by preventing instruction scheduling: +# +# set additional_flags "-fno-schedule-insns2"; +# +# but this would disguise the fact that there is a problem. Instead we use +# we generate an xfail result and explain that it is alias analysis that +# is at fault. + +set torture_eval_before_execute { + + set compiler_conditional_xfail_data { + "alias analysis conflicts with instruction scheduling" \ + "m32r-*-*" \ + { "-O2" "-O1" "-O0" "-Os"} \ + { "" } + } +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/981206-1.c b/gcc/testsuite/gcc.c-torture/execute/981206-1.c new file mode 100644 index 00000000000..12ec0ab1897 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/981206-1.c @@ -0,0 +1,17 @@ +/* Verify unaligned address aliasing on Alpha EV[45]. */ + +static unsigned short x, y; + +void foo() +{ + x = 0x345; + y = 0x567; +} + +int main() +{ + foo (); + if (x != 0x345 || y != 0x567) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/ultrasp1.c b/gcc/testsuite/gcc.dg/ultrasp1.c new file mode 100644 index 00000000000..8ccd60474ab --- /dev/null +++ b/gcc/testsuite/gcc.dg/ultrasp1.c @@ -0,0 +1,8 @@ +/* Simplified from testcase by David Staepelaere <staapa@ultimatech.com> */ + +/* { dg-do compile { xfail sparc-*-* } } */ +/* { dg-options -mcpu=ultrasparc { target sparc-*-*-* } } */ + +int foo(long long y) { + return -1 * y; +} |