public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dps at simpson dot demon dot co dot uk" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/43997] New: -finline-small-functions related oops Date: Wed, 05 May 2010 22:02:00 -0000 [thread overview] Message-ID: <bug-43997-11242@http.gcc.gnu.org/bugzilla/> (raw) The following source file, which a reduced version of a gmp 5.0.1 test triggers and internal compiler error when compiled with -finline-small-functions. I have removed most of what is not required to tickle the bug. I aware of at least one other file which triggers the same bug for me. Screen shot: $ gcc --version gcc (GCC) 4.6.0 20100504 (experimental) Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ gcc -c -O -o /tmp/foo.o gcc-bug-red.c $ gcc -c -O -finline-small-functions -o /tmp/foo.o gcc-bug-red.c gcc-bug-red.c:243:1: internal compiler error: in cgraph_decide_inlining_of_small_functions, at ipa-inline.c:1007 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. $ cat gcc-bug-red.c extern int printf (__const char *__restrict __format, ...); extern void abort (void) __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__)); typedef unsigned long int mp_limb_t; typedef mp_limb_t * mp_ptr; typedef const mp_limb_t * mp_srcptr; typedef long int mp_size_t; mp_limb_t __gmpn_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t) ; mp_limb_t __gmpn_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t) ; extern __inline__ __attribute__ ((__gnu_inline__)) mp_limb_t __gmpn_add_1 (mp_ptr __gmp_dst, mp_srcptr __gmp_src, mp_size_t __gmp_size, mp_limb_t __gmp_n) { mp_limb_t __gmp_c; do { mp_size_t __gmp_i; mp_limb_t __gmp_x, __gmp_r; __gmp_x = (__gmp_src)[0]; __gmp_r = __gmp_x + (__gmp_n); (__gmp_dst)[0] = __gmp_r; if (((__gmp_r) < ((__gmp_n)))) { (__gmp_c) = 1; for (__gmp_i = 1; __gmp_i < (__gmp_size);) { __gmp_x = (__gmp_src)[__gmp_i]; __gmp_r = __gmp_x + 1; (__gmp_dst)[__gmp_i] = __gmp_r; ++__gmp_i; if (!((__gmp_r) < (1))) { if ((__gmp_src) != (__gmp_dst)) do { mp_size_t __gmp_j; ; for (__gmp_j = (__gmp_i); __gmp_j < (__gmp_size); __gmp_j++) (__gmp_dst)[__gmp_j] = (__gmp_src)[__gmp_j]; } while (0); (__gmp_c) = 0; break; } } } else { if ((__gmp_src) != (__gmp_dst)) do { mp_size_t __gmp_j; ; for (__gmp_j = (1); __gmp_j < (__gmp_size); __gmp_j++) (__gmp_dst)[__gmp_j] = (__gmp_src)[__gmp_j]; } while (0); (__gmp_c) = 0; } } while (0); return __gmp_c; } extern __inline__ __attribute__ ((__gnu_inline__)) mp_limb_t __gmpn_sub_1 (mp_ptr __gmp_dst, mp_srcptr __gmp_src, mp_size_t __gmp_size, mp_limb_t __gmp_n) { mp_limb_t __gmp_c; do { mp_size_t __gmp_i; mp_limb_t __gmp_x, __gmp_r; __gmp_x = (__gmp_src)[0]; __gmp_r = __gmp_x - (__gmp_n); (__gmp_dst)[0] = __gmp_r; if (((__gmp_x) < ((__gmp_n)))) { (__gmp_c) = 1; for (__gmp_i = 1; __gmp_i < (__gmp_size);) { __gmp_x = (__gmp_src)[__gmp_i]; __gmp_r = __gmp_x - 1; (__gmp_dst)[__gmp_i] = __gmp_r; ++__gmp_i; if (!((__gmp_x) < (1))) { if ((__gmp_src) != (__gmp_dst)) do { mp_size_t __gmp_j; ; for (__gmp_j = (__gmp_i); __gmp_j < (__gmp_size); __gmp_j++) (__gmp_dst)[__gmp_j] = (__gmp_src)[__gmp_j]; } while (0); (__gmp_c) = 0; break; } } } else { if ((__gmp_src) != (__gmp_dst)) do { mp_size_t __gmp_j; ; for (__gmp_j = (1); __gmp_j < (__gmp_size); __gmp_j++) (__gmp_dst)[__gmp_j] = (__gmp_src)[__gmp_j]; } while (0); (__gmp_c) = 0; } } while (0); return __gmp_c; } typedef mp_limb_t (*mpn_aors_1_t) (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t); mpn_aors_1_t fudge (mpn_aors_1_t); void verify (const char *name, int i, mp_srcptr src, mp_limb_t n, mp_limb_t got_c, mp_limb_t want_c, mp_srcptr got, mp_srcptr want, mp_size_t size) { if (got[size] != 0x1234) { printf ("Overwrite at %s i=%d\n", name, i); abort (); } if (got_c != want_c) { printf ("Wrong at %s i=%d size=%ld\n", name, i, size); abort (); } } void check_add_1 (void) { static const struct { mp_size_t size; mp_limb_t n; const mp_limb_t src[10]; mp_limb_t want_c; const mp_limb_t want[10]; } data[] = { { 1, 0, { 0 }, 0, { 0 } }, }; mp_limb_t got[10]; mp_limb_t got_c; int i; for (i = 0; i < (sizeof (data) / sizeof ((data)[0])); i++) { got_c = __gmpn_add_1 (got, data[i].src, data[i].size, data[i].n); do { verify ("check_add_1 (separate)", i, data[i].src, data[i].n, got_c, data[i].want_c, got, data[i].want, data[i].size); } while (0); } } void check_sub_1 (void) { static const struct { mp_size_t size; mp_limb_t n; const mp_limb_t src[10]; mp_limb_t want_c; const mp_limb_t want[10]; } data[] = { { 1, 0, { 0 }, 0, { 0 } }, }; mp_limb_t got[10]; mp_limb_t got_c; int i; for (i = 0; i < (sizeof (data) / sizeof ((data)[0])); i++) { got_c = __gmpn_sub_1 (got, data[i].src, data[i].size, data[i].n); do { verify ("check_sub_1 (separate)", i, data[i].src, data[i].n, got_c, data[i].want_c, got, data[i].want, data[i].size); } while (0); } } mpn_aors_1_t fudge (mpn_aors_1_t f) { return f; } int main (void) { check_add_1 (); check_sub_1 (); return 0; } -- Summary: -finline-small-functions related oops Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dps at simpson dot demon dot co dot uk GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43997
next reply other threads:[~2010-05-05 22:02 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-05-05 22:02 dps at simpson dot demon dot co dot uk [this message] 2010-05-05 22:05 ` [Bug middle-end/43997] " dps at simpson dot demon dot co dot uk 2010-05-05 22:47 ` [Bug middle-end/43997] [4.6 Regression] " falk at debian dot org 2010-05-06 3:58 ` hjl dot tools at gmail dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-43997-11242@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).