aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey A Law <law@cygnus.com>2001-09-05 13:16:46 +0000
committerJeffrey A Law <law@cygnus.com>2001-09-05 13:16:46 +0000
commit55f847abb8bc755d1047b9a4aa65373a18ef577e (patch)
treea3bebd7ab6b588243c494943d8fa9261b5e49f29
parentcc697e3027a4241f8e615d9db68be6aafe8e22b2 (diff)
* stor-layout.c (layout_type): Complain if an array's size can
not be represented in a size_t. * config/h8300/elf.h (ENDFILE_SPEC, STARTFILE_SPEC): Define. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@45413 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/h8300/elf.h11
-rw-r--r--gcc/stor-layout.c13
3 files changed, 32 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1352561535d..bc21be5cc13 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2001-09-05 Jeffrey A Law (law@cygnus.com)
+ Jason Merrill (jason@redhat.com)
+
+ * stor-layout.c (layout_type): Complain if an array's size can
+ not be represented in a size_t.
+
+ * config/h8300/elf.h (ENDFILE_SPEC, STARTFILE_SPEC): Define.
+
2001-09-05 David Billinghurst <David.Billinghurst@riotinto.com>
* gcc.c: (process_command) Add parentheses around assignment
diff --git a/gcc/config/h8300/elf.h b/gcc/config/h8300/elf.h
index 7cf0b645cdd..20aa4cfd6cc 100644
--- a/gcc/config/h8300/elf.h
+++ b/gcc/config/h8300/elf.h
@@ -24,6 +24,17 @@
#include "elfos.h"
+
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC "crtend.o%s %{pg:gcrtn.o%s}%{!pg:crtn.o%s}"
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "%{!shared: \
+ %{!symbolic: \
+ %{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}\
+ %{pg:gcrti.o%s}%{!pg:crti.o%s} \
+ crtbegin.o%s"
+
/* Output at beginning/end of assembler file. */
#undef ASM_FILE_START
#define ASM_FILE_START(FILE) \
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index dfa4c107ca3..3a4f998902f 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -1442,6 +1442,19 @@ layout_type (type)
if (TYPE_SIZE_UNIT (element) != 0 && ! integer_onep (element_size))
TYPE_SIZE_UNIT (type)
= size_binop (MULT_EXPR, TYPE_SIZE_UNIT (element), length);
+
+ /* Complain if the user has requested an array too large to
+ fit in size_t. */
+ if (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
+ && TREE_OVERFLOW (TYPE_SIZE (type)))
+ {
+ error ("requested array too large for target");
+
+ /* Avoid crashing later. */
+ TYPE_SIZE (type) = element_size;
+ if (TYPE_SIZE_UNIT (type))
+ TYPE_SIZE_UNIT (type) = TYPE_SIZE_UNIT (element);
+ }
}
/* Now round the alignment and size,