Jakub Jelinek commented on freenode/#gcc:

from quick look at the kernel, I'd say the kernel is buggy
I'd say used attribute is a must in the #define __videocard struct card_info 
__attribute__((section(".videocards")))
because when it declares static __videocard var = { ... }; then the compiler 
has all rights to just nuke those as unused
though I can't reproduce it with:

struct S { int i, j; };
static struct S __attribute__((section ("foobar"))) s = { 1, 2 };
void foo (void)
{
  s.i = 2;
  s.j = 3;
}

actually, the kernel code is even more insane

struct S { int i, j; void (*p) (void); };
static struct S __attribute__((section ("foobar"))) s;
static void foo (void)
{
  s.i = 2;
  s.j = 3;
}
static struct S __attribute__((section ("foobar"))) s = { 1, 2, foo };

if this ever worked, it was purely by accident
note that the struct var is static, not marked as used, only used (visibly to 
the compiler) in a static function that is only referenced from the static 
struct variable's initializer
but please tell me which gcc would not optimize that away, even 4.1 at -O2 does

seems this got broken 4 years ago though
commit a1a00b58855ccdbedf556b4f5638d5208b454472
Author: Hannes Eder <[email protected]>
Date:   Sun Nov 23 19:37:09 2008 +0100
a preprocessed testcase still would be nice to see if for some reason it 
happens not to be optimized out by month old 4.7 and is right now
but the reduced testcase from what I saw in the kernel code really optimizes to 
nothing even in 4.1
even 3.4 does, 3.3/3.2 doesn't at -O2

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1049650

Title:
  Regression: "Undefined video mode" with 3.5.0-14.16

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1049650/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to