public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c/22362] New: Register allocation problem in combination with -funit-at-a-time and global register variables @ 2005-07-08 7:22 peter at hawkins dot emu dot id dot au 2005-07-08 14:38 ` [Bug target/22362] [3.4/4.0/4.1 Regression] static function calls " pinskia at gcc dot gnu dot org ` (6 more replies) 0 siblings, 7 replies; 8+ messages in thread From: peter at hawkins dot emu dot id dot au @ 2005-07-08 7:22 UTC (permalink / raw) To: gcc-bugs Hi... I'm using debian's unstable gcc 4.0: $ gcc -v Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --enable-nls --without-included-gettext --enable-threads=posix --program-suffix=-4.0 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr --disable-werror --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.0.1 20050701 (prerelease) (Debian 4.0.0-12) I'm trying to compile the following code (which is a reduced test case generated from mercury_deep_copy.c in the Mercury compiler version ROTD 20050707 from http://www.cs.mu.oz.au/mercury/): register unsigned int reg0 __asm__("esi"); register unsigned int reg1 __asm__("edi"); register unsigned int reg2 __asm__("ebx"); static unsigned int MR_deep_copy_typeclass_info(unsigned int *typeclass_info, void *lower_limit, void *upper_limit) { int i; for (i = 5; i > 0; i--) { typeclass_info[i] = (unsigned int) MR_deep_copy_typeclass_info( (unsigned int *)typeclass_info[i], lower_limit, lower_limit); } return 0; } unsigned int func(void) { return MR_deep_copy_typeclass_info(0, 0, 0); } using this command line: $ gcc -c test3.c -O -funit-at-a-time which produces this: test3.c: In function 'MR_deep_copy_typeclass_info': test3.c:17: error: unable to find a register to spill in class 'GENERAL_REGS' test3.c:17: error: this is the insn: (insn 27 26 28 1 (set (reg:SI 0 ax) (mem:SI (plus:SI (reg:SI 70) (const_int 4 [0x4])) [0 S4 A32])) 41 {*movsi_1} (insn_list:REG_DEP_TRUE 22 (nil)) (nil)) test3.c:17: confused by earlier errors, bailing out The same code compiles with -O1 and no -funit-at-a-time. It also compiles with gcc-3.4, so this is a gcc 4 regression. I suspect this means -funit-at-a-time behaves badly under high register pressure. =) Peter -- Summary: Register allocation problem in combination with -funit- at-a-time and global register variables Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: peter at hawkins dot emu dot id dot au CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22362 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/22362] [3.4/4.0/4.1 Regression] static function calls and global register variables 2005-07-08 7:22 [Bug c/22362] New: Register allocation problem in combination with -funit-at-a-time and global register variables peter at hawkins dot emu dot id dot au @ 2005-07-08 14:38 ` pinskia at gcc dot gnu dot org 2005-07-22 21:17 ` pinskia at gcc dot gnu dot org ` (5 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-07-08 14:38 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-07-08 14:37 ------- What is happening is that MR_deep_copy_typeclass_info is not being inlined but instead GCC changes the how the arguments are passed, via registers. This is a target bug. The bug is in: /* Use register calling convention for local functions when possible. */ if (!TARGET_64BIT && !user_convention && decl && flag_unit_at_a_time && !profile_flag) { This is a latent bug in 3.4.0 also. In a way this could be reproduced in 3.4.0. This is a 3.4.0 and 4.0.0 and 4.1.0 regression (even though it is harder to reproduce in 3.4.0 and 4.1.0). -- What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Component|c |target Ever Confirmed| |1 Keywords| |ice-on-valid-code Last reconfirmed|0000-00-00 00:00:00 |2005-07-08 14:37:52 date| | Summary|Register allocation problem |[3.4/4.0/4.1 Regression] |in combination with -funit- |static function calls and |at-a-time and global |global register variables |register variables | Target Milestone|--- |3.4.5 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22362 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/22362] [3.4/4.0/4.1 Regression] static function calls and global register variables 2005-07-08 7:22 [Bug c/22362] New: Register allocation problem in combination with -funit-at-a-time and global register variables peter at hawkins dot emu dot id dot au 2005-07-08 14:38 ` [Bug target/22362] [3.4/4.0/4.1 Regression] static function calls " pinskia at gcc dot gnu dot org @ 2005-07-22 21:17 ` pinskia at gcc dot gnu dot org 2005-08-17 12:37 ` bonzini at gcc dot gnu dot org ` (4 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-07-22 21:17 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-07-22 21:13 ------- Moving to 4.0.2 pre Mark. -- What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|3.4.5 |4.0.2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22362 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/22362] [3.4/4.0/4.1 Regression] static function calls and global register variables 2005-07-08 7:22 [Bug c/22362] New: Register allocation problem in combination with -funit-at-a-time and global register variables peter at hawkins dot emu dot id dot au 2005-07-08 14:38 ` [Bug target/22362] [3.4/4.0/4.1 Regression] static function calls " pinskia at gcc dot gnu dot org 2005-07-22 21:17 ` pinskia at gcc dot gnu dot org @ 2005-08-17 12:37 ` bonzini at gcc dot gnu dot org 2005-09-05 13:22 ` jakub at gcc dot gnu dot org ` (3 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: bonzini at gcc dot gnu dot org @ 2005-08-17 12:37 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From bonzini at gcc dot gnu dot org 2005-08-17 12:36 ------- A solution could be to count the number of global register vars, and decrease the number of regparm'd parameters accordingly. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22362 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/22362] [3.4/4.0/4.1 Regression] static function calls and global register variables 2005-07-08 7:22 [Bug c/22362] New: Register allocation problem in combination with -funit-at-a-time and global register variables peter at hawkins dot emu dot id dot au ` (2 preceding siblings ...) 2005-08-17 12:37 ` bonzini at gcc dot gnu dot org @ 2005-09-05 13:22 ` jakub at gcc dot gnu dot org 2005-09-06 19:58 ` cvs-commit at gcc dot gnu dot org ` (2 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: jakub at gcc dot gnu dot org @ 2005-09-05 13:22 UTC (permalink / raw) To: gcc-bugs -- What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |jakub at gcc dot gnu dot org |dot org | URL| |http://gcc.gnu.org/ml/gcc- | |patches/2005- | |09/msg00279.html Status|NEW |ASSIGNED Last reconfirmed|2005-07-08 14:37:52 |2005-09-05 13:22:14 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22362 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/22362] [3.4/4.0/4.1 Regression] static function calls and global register variables 2005-07-08 7:22 [Bug c/22362] New: Register allocation problem in combination with -funit-at-a-time and global register variables peter at hawkins dot emu dot id dot au ` (3 preceding siblings ...) 2005-09-05 13:22 ` jakub at gcc dot gnu dot org @ 2005-09-06 19:58 ` cvs-commit at gcc dot gnu dot org 2005-09-06 20:03 ` cvs-commit at gcc dot gnu dot org 2005-09-06 20:13 ` [Bug target/22362] [3.4 " pinskia at gcc dot gnu dot org 6 siblings, 0 replies; 8+ messages in thread From: cvs-commit at gcc dot gnu dot org @ 2005-09-06 19:58 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-09-06 19:58 ------- Subject: Bug 22362 CVSROOT: /cvs/gcc Module name: gcc Changes by: jakub@gcc.gnu.org 2005-09-06 19:57:57 Modified files: gcc : ChangeLog gcc/config/i386: i386.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.target/i386: pr22362.c Log message: PR target/22362 * config/i386/i386.c (ix86_function_regparm): Make sure automatic regparm for internal functions doesn't use registers used by global registers variables. Use fewer register parameters if there are global register variables. * gcc.target/i386/pr22362.c: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9905&r2=2.9906 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&r1=1.857&r2=1.858 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6019&r2=1.6020 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.target/i386/pr22362.c.diff?cvsroot=gcc&r1=NONE&r2=1.1 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22362 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/22362] [3.4/4.0/4.1 Regression] static function calls and global register variables 2005-07-08 7:22 [Bug c/22362] New: Register allocation problem in combination with -funit-at-a-time and global register variables peter at hawkins dot emu dot id dot au ` (4 preceding siblings ...) 2005-09-06 19:58 ` cvs-commit at gcc dot gnu dot org @ 2005-09-06 20:03 ` cvs-commit at gcc dot gnu dot org 2005-09-06 20:13 ` [Bug target/22362] [3.4 " pinskia at gcc dot gnu dot org 6 siblings, 0 replies; 8+ messages in thread From: cvs-commit at gcc dot gnu dot org @ 2005-09-06 20:03 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-09-06 20:03 ------- Subject: Bug 22362 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: jakub@gcc.gnu.org 2005-09-06 20:03:28 Modified files: gcc : ChangeLog gcc/config/i386: i386.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.target/i386: pr22362.c Log message: PR target/22362 * config/i386/i386.c (ix86_function_regparm): Make sure automatic regparm for internal functions doesn't use registers used by global registers variables. Use fewer register parameters if there are global register variables. * gcc.target/i386/pr22362.c: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.414&r2=2.7592.2.415 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.795.6.10&r2=1.795.6.11 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.385&r2=1.5084.2.386 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.target/i386/pr22362.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22362 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/22362] [3.4 Regression] static function calls and global register variables 2005-07-08 7:22 [Bug c/22362] New: Register allocation problem in combination with -funit-at-a-time and global register variables peter at hawkins dot emu dot id dot au ` (5 preceding siblings ...) 2005-09-06 20:03 ` cvs-commit at gcc dot gnu dot org @ 2005-09-06 20:13 ` pinskia at gcc dot gnu dot org 6 siblings, 0 replies; 8+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-09-06 20:13 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-09-06 20:13 ------- Still a latent bug/regression on the 3.4 branch. -- What |Removed |Added ---------------------------------------------------------------------------- Known to fail| |4.0.0 4.0.1 Known to work| |3.3.3 4.0.2 4.1.0 Summary|[3.4/4.0/4.1 Regression] |[3.4 Regression] static |static function calls and |function calls and global |global register variables |register variables Target Milestone|4.0.2 |3.4.5 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22362 ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-09-06 20:13 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-07-08 7:22 [Bug c/22362] New: Register allocation problem in combination with -funit-at-a-time and global register variables peter at hawkins dot emu dot id dot au 2005-07-08 14:38 ` [Bug target/22362] [3.4/4.0/4.1 Regression] static function calls " pinskia at gcc dot gnu dot org 2005-07-22 21:17 ` pinskia at gcc dot gnu dot org 2005-08-17 12:37 ` bonzini at gcc dot gnu dot org 2005-09-05 13:22 ` jakub at gcc dot gnu dot org 2005-09-06 19:58 ` cvs-commit at gcc dot gnu dot org 2005-09-06 20:03 ` cvs-commit at gcc dot gnu dot org 2005-09-06 20:13 ` [Bug target/22362] [3.4 " pinskia at gcc dot gnu dot org
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).