15717 – [3.4/4.0 Regression] Error: can't resolve `L0' {ABS section} (original) (raw)

Description Zdenek Dvorak 2004-05-28 21:02:22 UTC

The following testcase

struct x { int a[100]; int b[100]; };

extern struct x xx;

void xxx(void) { unsigned long a = (unsigned long) &xx.b[0];

printf ("%ld", -a); }

Fails to compile with

/xgcc -B. -O1 -c yyy.c /tmp/ccBFXfe3.s: Assembler messages: /tmp/ccBFXfe3.s:13: Error: can't resolve L0' {*ABS* section} - xx' {UND section}

The problem is that cse produces the following rtl:

(const:SI (minus:SI (const_int -400 [0xfffffe70]) (symbol_ref:SI ("xx") [flags 0x40] <var_decl 0x402ec000 xx>)))

Which translates to assembler like

movl $-400-xx, 4(%esp)

Which as does not like.

Comment 1 Drea Pinski 2004-05-28 21:34:49 UTC

I do not know if this is really a bug at all because it is really undefined. Note with an earlier version of as I get: temp.s: Assembler messages: temp.s:12: Error: negative of non-absolute symbol `xx'

The only thing we can do I can think of is reject (minus xxx Symbol_Ref) as a valid constant.

I should note that i686-darwin's as also rejects it (it is a much older GNU as).

Comment 2 Zdenek Dvorak 2004-05-29 07:47:09 UTC

Subject: Re: [3.4/3.5 Regression] Error: can't resolve L0' {*ABS* section} - xx' {UND section}

------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-28 21:34 ------- I do not know if this is really a bug at all because it is really undefined.

I believe it is defined:

"Any pointer type may be converted to an integer type; the result is implementation-defined" (c99 standard draft)

Or is there something else you have objections against?

Zdenek

Note with an earlier version of as I get: temp.s: Assembler messages: temp.s:12: Error: negative of non-absolute symbol `xx'

The only thing we can do I can think of is reject (minus xxx Symbol_Ref) as a valid constant.

I should note that i686-darwin's as also rejects it (it is a much older GNU as).

-- What |Removed |Added

         Status|UNCONFIRMED                 |NEW
 Ever Confirmed|                            |1
       Keywords|                            |wrong-code
  Known to fail|                            |3.4.0 3.5.0
  Known to work|                            |3.3.3

Last reconfirmed|0000-00-00 00:00:00 |2004-05-28 21:34:50 date| | Summary|Error: can't resolve L0' |[3.4/3.5 Regression] Error: |{*ABS* section} - xx' |can't resolve L0' {*ABS* |{*UND* section} |section} - xx' {UND | |section} Target Milestone|--- |3.4.1

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15717

------- You are receiving this mail because: ------- You reported the bug, or are watching the reporter.

Comment 4 Mark Mitchell 2004-05-31 22:17:42 UTC

This patch is OK for 3.4.1, assuming it passes the regression tests; please apply it to 3.4.1 and mainline.

Comment 7 Drea Pinski 2004-06-08 17:57:24 UTC

Fixed.