------- Comment #5 from rguenth at gcc dot gnu dot org 2009-03-04 16:40 ------- Reduced testcase:
typedef unsigned short u16; struct snd_kcontrol_new { }; typedef u16 hda_nid_t; struct alc_spec { struct snd_kcontrol_new *cap_mixer; unsigned int num_adc_nids; }; static struct snd_kcontrol_new alc_capture_mixer1[] = { }; static struct snd_kcontrol_new alc_capture_mixer2[] = { }; static struct snd_kcontrol_new alc_capture_mixer3[] = { }; static void set_capture_mixer(struct alc_spec *spec) { static struct snd_kcontrol_new *caps[3] = { alc_capture_mixer1, alc_capture_mixer2, alc_capture_mixer3 }; if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) spec->cap_mixer = caps[spec->num_adc_nids - 1]; } static hda_nid_t alc662_adc_nids[1] = { 0x09, }; int patch_alc662(struct hda_codec *codec) { struct alc_spec *spec; spec->num_adc_nids = (sizeof(alc662_adc_nids) / sizeof((alc662_adc_nids)[0]) + (sizeof(char[1 - 2 * !!(__builtin_types_compatible_p(typeof(alc662_adc_nids), typeof(&alc662_adc_nids[0])))]) - 1)); if (!spec->cap_mixer) set_capture_mixer(spec); } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39360