See attached test case. Observe the number of times certain lines of the 'vesa_modes' array are emitted. This isn't particularly optimal, especially as it happens even with -Os. $ make cc -Os -c -o fbmon.o fbmon.i -save-temps grep 39682 fbmon.s .long 39682 .long 39682
Created attachment 12084 [details] test case
This is an expand/middle-end issue as get: *mode = vesa_modes[0]; in the final_cleanup.
Confirmed, here is the testcase for lazy people (like me) who really don't want to download the tar file: struct fb_videomode { const char *name; unsigned refresh; unsigned xres; unsigned yres; unsigned pixclock; unsigned left_margin; unsigned right_margin; unsigned upper_margin; unsigned lower_margin; unsigned hsync_len; unsigned vsync_len; unsigned sync; unsigned vmode; unsigned flag; }; const struct fb_videomode vesa_modes[] = { { ((void *)0), 60, 640, 480, 39682, 48, 16, 33, 10, 96, 2, 0, 0, 4 }, }; void get_est_timing(unsigned char *block, struct fb_videomode *mode) { mode[0] = vesa_modes[0]; } ------- Oh this is not a regression as far as I can tell.
Actually it is a regression from 2.95.3, I just had to go back in time enough to get find that.
Subject: Bug number PR middle-end/28755 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-08/msg00601.html
Won't fix in GCC-4.0.x. Adjusting milestone.
Subject: Bug 28755 Author: jakub Date: Sun Sep 23 09:34:28 2007 New Revision: 128685 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128685 Log: PR middle-end/28755 * expr.c (expand_constructor): New function. (expand_expr_real_1) <case CONSTRUCTOR>: Call it. (expand_expr_real_1) <case ARRAY_REF>: Call it if VALUE is CONSTRUCTOR. * gcc.dg/pr28755.c: New test. Added: trunk/gcc/testsuite/gcc.dg/pr28755.c Modified: trunk/gcc/ChangeLog trunk/gcc/expr.c trunk/gcc/testsuite/ChangeLog
Fixed on the trunk.
(In reply to comment #8) > Fixed on the trunk. > For anyone else wondering, this is still reproductible on vanilla gcc 4.2.2.
Closing 4.1 branch.
Closing 4.2 branch, fixed in 4.3.