This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR optimization/12324

Jan Hubicka wrote:
On Sat, 27 Sep 2003, Jan Hubicka wrote:

the problem is that we deffer compound literals until after finalizing
compilation unit (like we currently do for declarations without initializer).
I don't see any reason for doing so.  Would be this OK?

The point is that when the extension (gnu89 mode only, used by Linux kernel) where compound literals can be used as static initializers (as if they were the brace-enclosed list rather than an anonymous variable) is used, the compound literal shouldn't itself be emitted - only the initialized variable. Does this patch preserve that property?

I am not quite sure I follow this. Can you show me some testcase? In non-unit-at-a-time the compound literal will be output always I guess after my patch, while in unit-at-a-time only when it is actually used. Perhaps we can add if (!flag_unit_at_a_time) around that line instead.

I've submitted this PR. The attached test case is a simplified case of a real case from linux/drivers/net/fec.c:

static phy_info_t phy_info_am79c874 = { 0x00022561, "AM79C874", (const phy_cmd_t []) { /* config */ /* limit to 10MBit because my protorype board * doesn't work with 100. */ { mk_mii_read(MII_REG_CR), mii_parse_cr }, { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, { mk_mii_read(MII_AM79C874_DR), mii_parse_am79c874_dr }, { mk_mii_end, } }, (const phy_cmd_t []) { /* startup - enable interrupts */ { mk_mii_write(MII_AM79C874_ICSR, 0xff00), NULL }, { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ { mk_mii_read(MII_REG_SR), mii_parse_sr }, { mk_mii_end, } },



All those mk_parse_foobar things are pointers to static functions.
The regression with 3.4 causes them to be omitted in the output
because the compiler doesn't notice they're being referenced.

 // Bernardo Innocenti - Develer S.r.l., R&D dept.

Please don't send Word attachments -

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]