I haven't looked at it very carefully, but it seems to me that the way VLAs are currently implemented in TCC is not compatible with signal handlers, or anything else that might use the stack asynchronously.
For example, when goto is translated, if there are VLAs in scope then gen_vla_sp_restore(vla_sp_root_loc) is called, which generates code to move the SP back to where it was at the start of the function body. At the target location, where the label is, if any VLAs are in scope at that location code generated by gen_vla_sp_restore(vla_sp_loc) advances the SP again. If a signal were to arrive between the two SP moves then the signal handler might overwrite live data on the stack. In fact, this problem was detected by Valgrind without any signals. Is this worth fixing? Or just document it as a limitation? Does TCC's implementation of VLAs have any other known limitations? _______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
