Bug 52657 - [4.7/4.8 regression] error on asm during GMP build
Summary: [4.7/4.8 regression] error on asm during GMP build
Status: RESOLVED DUPLICATE of bug 48496
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2012-03-21 16:53 UTC by Eric Botcazou
Modified: 2012-04-06 15:41 UTC (History)
1 user (show)

See Also:
Host:
Target: ia64-*-linux
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Reduced testcase (382 bytes, text/plain)
2012-03-21 16:53 UTC, Eric Botcazou
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Botcazou 2012-03-21 16:53:54 UTC
Created attachment 26944 [details]
Reduced testcase

GMP cannot be compiled anymore on IA-64/Linux, the error being:

gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_redc_2 -O2 -pedantic -c 
redc_2.c -o redc_2.o
redc_2.c: In function '__gmpn_redc_2':
redc_2.c:87:7: error: 'asm' operand requires impossible reload
redc_2.c:87:7: error: 'asm' operand requires impossible reload
redc_2.c:87:7: error: 'asm' operand requires impossible reload
redc_2.c:87:7: error: 'asm' operand requires impossible reload
make[2]: *** [redc_2.lo] Error 1

The error is issued by this very old piece of code in reload_as_needed:

	      /* If this was an ASM, make sure that all the reload insns
		 we have generated are valid.  If not, give an error
		 and delete them.  */
	      if (asm_noperands (PATTERN (insn)) >= 0)
		for (p = NEXT_INSN (prev); p != next; p = NEXT_INSN (p))
		  if (p != insn && INSN_P (p)
		      && GET_CODE (PATTERN (p)) != USE
		      && (recog_memoized (p) < 0
			  || (extract_insn (p), ! constrain_operands (1))))
		    {
		      error_for_asm (insn,
				     "%<asm%> operand requires "
				     "impossible reload");
		      delete_insn (p);
		    }

Now it seems to overlook the case where the reload insns contain pseudos that 
didn't get hard regs and thus have equivalent memory references.  They will be 
replaced by these memory references only _after_ reload_as_needed has run.

Commenting out the piece code generates correct assembly AFAICS and the GMP 
testsuite is clean.  But it seems quite astonishing that this issue has never 
surfaced until now (the code was added by Richard Kenner almost 20 years ago).
Comment 1 Uroš Bizjak 2012-03-21 17:00:22 UTC
Dup of 48496.
Comment 2 Eric Botcazou 2012-03-21 17:08:55 UTC
Indeed, too bad the bug wasn't fixed.

*** This bug has been marked as a duplicate of bug 48496 ***
Comment 3 Jeroen Demeyer 2012-04-06 14:18:59 UTC
While this is marked as duplicate of PR48496, the "fix" of PR48496 doesn't fix this bug.
Comment 4 Jeroen Demeyer 2012-04-06 14:25:09 UTC
Can this be re-opened please?  I still get the error with

gcc (GCC) 4.7.1 20120406 (prerelease)

PR48496 only provided a work-around for this bug in the libffi code, it didn't actually fix the bug.
Comment 5 Eric Botcazou 2012-04-06 15:41:20 UTC
> Can this be re-opened please?  I still get the error with
> 
> gcc (GCC) 4.7.1 20120406 (prerelease)
> 
> PR48496 only provided a work-around for this bug in the libffi code, it didn't
> actually fix the bug.

Sure, but it isn't marked as resolved so a fix will be provided there.