tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] VLAs broken on mob branch


From: Sergey Korshunoff
Subject: Re: [Tinycc-devel] VLAs broken on mob branch
Date: Sat, 25 Apr 2015 13:46:12 +0300

Hi! Another version of the patch for the case 4. It looks like we need
to init vla_sp_loc on the start of VLA's handling in
decl_initializer().

diff -urN tinycc.old/tccgen.c tinycc/tccgen.c
--- tinycc.old/tccgen.c 2015-04-25 13:25:03.000000000 +0300
+++ tinycc/tccgen.c     2015-04-25 13:37:00.000000000 +0300
@@ -2222,6 +2222,13 @@
     }
 }

+static void vla_sp_save_prepare(void) {
+    if (!(vla_flags & VLA_SP_LOC_SET)) {
+        *vla_sp_loc = (loc -= PTR_SIZE);
+        vla_flags |= VLA_SP_LOC_SET;
+    }
+}
+
 static void vla_sp_save(void) {
     if (!(vla_flags & VLA_SP_LOC_SET)) {
         *vla_sp_loc = (loc -= PTR_SIZE);
@@ -2233,6 +2240,7 @@
     }
 }

+
 /* return the pointed type of t */
 static inline CType *pointed_type(CType *type)
 {
@@ -5456,6 +5464,7 @@
             vla_flags = VLA_IN_SCOPE;
             vla_sp_loc = &vla_sp_loc_tmp;
         }
+        vla_sp_save_prepare();

         vla_runtime_type_size(type, &a);
         gen_vla_alloc(type, a);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]