static void R_EdgeDrawing (qboolean Translucent) { edge_t ledges[NUMSTACKEDGES + ((CACHE_SIZE - 1) / sizeof(edge_t)) + 1]; surf_t lsurfs[NUMSTACKSURFACES + ((CACHE_SIZE - 1) / sizeof(surf_t)) + 1]; ..
(see attached r_main-1.i and r_main-1.s) is incorrectly compiled when optimizations are turned off (no -O) with gcc-4.x series compilers on x86_64. -O1, -O2, -O3 and -Os are fine with gcc-4.x, whereas gcc-3.4.6 (as shipped with fedora 10) is fine with or without optimizations. If those vars are moved to the top of file as static (attached files r_main-3.i and r_main-3.s), gcc-4.x up to gcc-4.4.3 behave correctly without optimizations and the compiled program runs expectedly. gcc-3.4 is fine as before. gcc-4.5 is not tested. -- Summary: bad code with arrays as local vars and no optimization Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sezeroz at gmail dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41751