]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
stor-layout.c (layout_type): Complain if an array's size can not be represented in...
authorJeffrey A Law <law@cygnus.com>
Wed, 5 Sep 2001 13:16:46 +0000 (13:16 +0000)
committerJeff Law <law@gcc.gnu.org>
Wed, 5 Sep 2001 13:16:46 +0000 (07:16 -0600)
        * 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.

Co-Authored-By: Jason Merrill <jason@redhat.com>
From-SVN: r45413

gcc/ChangeLog
gcc/config/h8300/elf.h
gcc/stor-layout.c

index 1352561535dff3ccfa6f652d8b553e2548a720f5..bc21be5cc13855d253c1f52495e9cec6a575a3cd 100644 (file)
@@ -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 
index 7cf0b645cdd7ba7d9f15678d3b25391e29b027bd..20aa4cfd6cc0b46ea3a91b7c626d22d38d5580e2 100644 (file)
 
 #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)                            \
index dfa4c107ca365010f05d12c53bd8bfbe22783d74..3a4f998902fe8de812512969a29e627a4cbc1016 100644 (file)
@@ -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,