public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* ARM: testsuite gcc.c-torture/execute/20020307-2.c failure
@ 2002-11-12  5:39 jeroen dobbelaere
  2002-11-12  8:07 ` Richard Earnshaw
  0 siblings, 1 reply; 30+ messages in thread
From: jeroen dobbelaere @ 2002-11-12  5:39 UTC (permalink / raw)
  To: gcc

Looking at testcase
	gcc.c-torture/execute/20020307-2.c

It seems that there is a problem with putting the arguments in the right place.
Following peace of code

void foo3()
{
#ifdef USE_DEFINE
# define zzz 2
#else
   int zzz=2;
#endif
   struct {
     int a[zzz];
   } t;

   t.a[0]=1;
   t.a[1]=2;

   foo4(t);
}


results, depending on the definition of 'USE_DEFINE' in completely different output :
  - for structures with a fixed array length, we get following (correct) code : (-O2)

foo3:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	str	lr, [sp, #-4]!
	adr	r0, .L25
	ldmia	r0, {r0-r1}
	@ Sibcall epilogue
	ldr	lr, [sp], #4
	b	foo4
.L26:
	.align	2
.L25:
	.word	1
	.word	2

  - for structures with a variable array length, we get following (incorrect) code :

	.size	foo,.Lfe2-foo
	.global	memcpy
	.align	2
	.global	foo3
	.type	foo3,function
foo3:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	mov	ip, sp
	stmfd	sp!, {r4, r5, fp, ip, lr, pc}
	mov	r3, #1
	mov	r5, sp
	mov	r2, #2
	sub	sp, sp, #8
	str	r3, [sp, #0]
	str	r2, [sp, #4]
	mov	r4, sp
	sub	sp, sp, #8
	mov	r0, sp
	sub	fp, ip, #4
	mov	r2, r2, asl r2
	mov	r1, r4
	bl	memcpy
	bl	foo4
	mov	sp, r4
	mov	sp, r5
	ldmea	fp, {r4, r5, fp, sp, pc}


Between the 'bl memcpy' and 'bl foo4' there is no loading of r0-r1...

(in the case of 20020307-2 : this results in no loading of r1-r3, while the
target function expects to see data in those registers...)

Any idea where this different behavior is triggered ?

Greetings,
-- 
Jeroen Dobbelaere
Embedded Software Engineer

ACUNIA Embedded Solutions
http://www.acunia.com/aes


^ permalink raw reply	[flat|nested] 30+ messages in thread
* PCH tests fail on sparc-sun-solaris2.7
@ 2003-01-14  0:34 Kaveh R. Ghazi
  2003-01-14  2:03 ` Geoff Keating
  0 siblings, 1 reply; 30+ messages in thread
From: Kaveh R. Ghazi @ 2003-01-14  0:34 UTC (permalink / raw)
  To: geoffk; +Cc: gcc-bugs, gcc

Geoff - as seen here:
http://gcc.gnu.org/ml/gcc-testresults/2003-01/msg00571.html
pretty much all of the PCH tests fail on sparc-sun-solaris2.7.

Looking in the log file, all of the error messages look like this:

 > gcc.dg/pch/global-1.c:-71: sorry, unimplemented: had to relocate PCH
 > gcc.dg/pch/global-1.c:-71: internal compiler error: Segmentation Fault

(Sometimes the line number was -70 or -72 for the various other tests.)
The g++ tests fail the same way.

I looked in gcc.dg/pch/pch.exp and guessed that I had to generate the
PCH file by hand and rename it to *.hp.pch.  (Is that right?)  Then I
ran cc1 on global-1.c under gdb and got an invalid memory reference as
you can see below.  I'm not sure what I need to provide for you to
reproduce it in a cross config.  PCH perhaps requires us to update our
bug reporting instructions slightly?

		--Kaveh


 > (gdb) run -quiet -v -I. -iprefix
 > /teal/tmpdisk/ghazi/gcc-testing/34/build/gcc/../lib/gcc-lib/sparc-sun-solaris2.7/3.4/
 > -isystem /teal/tmpdisk/ghazi/gcc-testing/34/build/gcc/include
 > -D__GNUC__=3 -D__GNUC_MINOR__=4 -D__GNUC_PATCHLEVEL__=0 -Dsparc
 > -D__sparc__ -D__sparc -D__GCC_NEW_VARARGS__ -Acpu=sparc
 > -Amachine=sparc
 > /teal/tmpdisk/ghazi/gcc-testing/34/egcc-CVS20030112/gcc/testsuite/gcc.dg/pch/global-1.c
 > -quiet -dumpbase global-1.c -auxbase-strip global-1.s -O0 -version -o
 > global-1.s
 > Starting program: /teal/tmpdisk/ghazi/gcc-testing/34/build/gcc/cc1
 > -quiet -v -I. -iprefix
 > /teal/tmpdisk/ghazi/gcc-testing/34/build/gcc/../lib/gcc-lib/sparc-sun-solaris2.7/3.4/
 > -isystem /teal/tmpdisk/ghazi/gcc-testing/34/build/gcc/include
 > -D__GNUC__=3 -D__GNUC_MINOR__=4 -D__GNUC_PATCHLEVEL__=0 -Dsparc
 > -D__sparc__ -D__sparc -D__GCC_NEW_VARARGS__ -Acpu=sparc
 > -Amachine=sparc
 > /teal/tmpdisk/ghazi/gcc-testing/34/egcc-CVS20030112/gcc/testsuite/gcc.dg/pch/global-1.c
 > -quiet -dumpbase global-1.c -auxbase-strip global-1.s -O0 -version -o
 > global-1.s
 > 
 > GNU C version 3.4 20030112 (experimental) (sparc-sun-solaris2.7)
 >         compiled by GNU C version 3.4 20030112 (experimental).
 > ignoring nonexistent directory
 > "/teal/tmpdisk/ghazi/gcc-testing/34/build/lib/gcc-lib/sparc-sun-solaris2.7/3.4/include"
 > ignoring nonexistent directory
 > "/teal/tmpdisk/ghazi/gcc-testing/34/build/lib/gcc-lib/sparc-sun-solaris2.7/3.4/../../../../sparc-sun-solaris2.7/include"
 > ignoring nonexistent directory "NONE/include"
 > ignoring nonexistent directory
 > "/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/3.4/include"
 > ignoring nonexistent directory
 > "/usr/local/sparc-sun-solaris2.7/include"
 > #include "..." search starts here:
 > #include <...> search starts here:
 >  .
 >  /teal/tmpdisk/ghazi/gcc-testing/34/build/gcc/include
 >  /usr/local/include
 >  /usr/include
 > End of search list.
 > /teal/tmpdisk/ghazi/gcc-testing/34/egcc-CVS20030112/gcc/testsuite/gcc.dg/pch/global-1.c:-70: sorry, unimplemented: had to relocate PCH
 > Program received signal SIGSEGV, Segmentation fault.
 > reset_ht (r=0x440330, h=0xafafafbb, unused=0x0) at
 > ../../egcc-CVS20030112/gcc/cpppch.c:552
 > 552       if (h->type != NT_VOID
 > (gdb) bt
 > #0  reset_ht (r=0x440330, h=0xafafafbb, unused=0x0) at ../../egcc-CVS20030112/gcc/cpppch.c:552
 > #1  0x000a3ba0 in ht_forall (table=0x40b4a0, cb=0xa5bbc <reset_ht>, v=0x0) at ../../egcc-CVS20030112/gcc/hashtable.c:235
 > #2  0x000a5c18 in cpp_read_state (r=0x440330, name=0x4098e8 "global-1.hp.pch", f=0x409790, data=0x4467b0)
 >     at ../../egcc-CVS20030112/gcc/cpppch.c:583
 > #3  0x000923e0 in c_common_read_pch (pfile=0x440330, name=0x4098e8 "global-1.hp.pch", fd=4779608,
 >     orig_name=0x4098e8 "global-1.hp.pch") at ../../egcc-CVS20030112/gcc/c-pch.c:220
 > #4  0x0009e5ac in stack_include_file (pfile=0x440330, inc=0x48cc38) at ../../egcc-CVS20030112/gcc/cppfiles.c:437
 > #5  0x0009eca8 in _cpp_execute_include (pfile=0x440330, header=0x4405b8, type=IT_INCLUDE)
 >     at ../../egcc-CVS20030112/gcc/cppfiles.c:828
 > #6  0x0009282c in _cpp_handle_directive (pfile=0x440330, indented=0) at ../../egcc-CVS20030112/gcc/cpplib.c:443
 > #7  0x00095dd8 in _cpp_lex_token (pfile=0x440330) at ../../egcc-CVS20030112/gcc/cpplex.c:864
 > #8  0x0009962c in cpp_get_token (pfile=0x440330) at ../../egcc-CVS20030112/gcc/cppmacro.c:1123
 > #9  0x00047240 in c_lex (value=0x3a6ea0) at ../../egcc-CVS20030112/gcc/c-lex.c:683
 > #10 0x0003e748 in _yylex () at c-parse.y:2953
 > #11 0x0003e574 in yylex () at c-parse.y:3061
 > #12 0x0003c7d0 in yyparse () at c-p21554.c:2479
 > #13 0x00046ce4 in c_common_parse_file (set_yydebug=0) at ../../egcc-CVS20030112/gcc/c-lex.c:165
 > #14 0x00284d54 in compile_file () at ../../egcc-CVS20030112/gcc/toplev.c:2130
 > #15 0x0028a898 in do_compile () at ../../egcc-CVS20030112/gcc/toplev.c:5353
 > #16 0x0028a95c in toplev_main (argc=27, argv=0xffbef904) at ../../egcc-CVS20030112/gcc/toplev.c:5384
 > (gdb) p h
 > $1 = (cpp_hashnode *) 0xafafafbb
 > (gdb) p *h
 > Cannot access memory at address 0xafafafbb

--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu

^ permalink raw reply	[flat|nested] 30+ messages in thread
* rfc: clobber all call-saved registers
@ 2002-01-08 16:45 Richard Henderson
  2002-01-08 17:39 ` Hans-Peter Nilsson
  2002-01-09 15:44 ` Alexandre Oliva
  0 siblings, 2 replies; 30+ messages in thread
From: Richard Henderson @ 2002-01-08 16:45 UTC (permalink / raw)
  To: gcc

On two instances in the last week, I've created reduced test
cases in which it was necessary to convince reload that it
could not put a particular value into a hard register in order
to elicit the problem.  In both instances I had to create a
platform-specific test that used an asm to clobber all the
registers in question.

I hate creating platform specific tests for potentially generic
problems, since the problem is bound to show up somewhere else
as well.  So what to do?  I can think of two options:

(1) A header file somewhere in the testsuite that has a whole
    whale-load of ifdefs and chooses the correct asm statement,

(2) A compiler builtin that generates the correct asm statement
    based on the contents of call_used[].

Thoughts?


r~

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2003-01-22 23:52 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-12  5:39 ARM: testsuite gcc.c-torture/execute/20020307-2.c failure jeroen dobbelaere
2002-11-12  8:07 ` Richard Earnshaw
2002-11-12  8:46   ` jeroen dobbelaere
2002-11-12 10:36     ` Richard Earnshaw
2002-11-12 11:05       ` David Edelsohn
2002-11-13  2:06         ` Richard Earnshaw
2002-11-13  5:43           ` [patch] " jeroen dobbelaere
2002-11-13  8:36             ` jeroen dobbelaere
2002-11-13  9:50               ` Richard Earnshaw
2002-11-14  2:40                 ` jeroen dobbelaere
2002-11-14  6:37                   ` Richard Earnshaw
  -- strict thread matches above, loose matches on Subject: below --
2003-01-14  0:34 PCH tests fail on sparc-sun-solaris2.7 Kaveh R. Ghazi
2003-01-14  2:03 ` Geoff Keating
2003-01-14 18:10   ` Richard Earnshaw
2003-01-14 20:05     ` David Edelsohn
2003-01-14 20:38     ` David Edelsohn
2003-01-19 17:37   ` Kaveh R. Ghazi
2003-01-20  0:31     ` Geoff Keating
2003-01-21  8:03       ` Segher Boessenkool
2003-01-23  2:16         ` Kaveh R. Ghazi
2002-01-08 16:45 rfc: clobber all call-saved registers Richard Henderson
2002-01-08 17:39 ` Hans-Peter Nilsson
2002-01-09  3:06   ` Richard Earnshaw
2002-01-09  3:14     ` Richard Henderson
2002-01-09  4:40       ` Richard Earnshaw
2002-01-09  5:15         ` Joseph S. Myers
2002-01-09  4:07     ` Gabriel Dos Reis
2002-01-09 15:44 ` Alexandre Oliva
2002-01-10  4:37   ` Richard Earnshaw
2002-01-10 10:13     ` David Edelsohn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).