public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/33763]  New: [4.1/4.2/4.3 Regression] Bogus inlining failed in call to `xxx': redefined extern inline functions are not considered for inlining
@ 2007-10-13 19:15 jakub at gcc dot gnu dot org
  2007-10-14 10:26 ` [Bug tree-optimization/33763] " rguenth at gcc dot gnu dot org
                   ` (18 more replies)
  0 siblings, 19 replies; 23+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-10-13 19:15 UTC (permalink / raw)
  To: gcc-bugs

/* { dg-do compile } */
/* { dg-options "-O2" } */

typedef struct
{
  void *a;
  void *b;
} T;
extern void *foo (const char *, const char *);
extern void *bar (void *, const char *, T);
extern int baz (const char *, int);

extern inline __attribute__ ((always_inline, gnu_inline)) int
baz (const char *x, int y)
{
  return 2;
}

int
baz (const char *x, int y)
{
  return 1;
}

int xa, xb;

static void *
inl (const char *x, const char *y)
{
  T t = { &xa, &xb };
  int *f = (int *) __builtin_malloc (sizeof (int));
  const char *z;
  int o = 0;
  void *r = 0;

  for (z = y; *z; z++)
    {
      if (*z == 'r')
        o |= 1;
      if (*z == 'w')
        o |= 2;
    }
  if (o == 1)
    *f = baz (x, 0);
  if (o == 2)
    *f = baz (x, 1);
  if (o == 3)
    *f = baz (x, 2);

  if (o && *f > 0)
    r = bar (f, "w", t);
  return r;
}

void *
foo (const char *x, const char *y)
{
  return inl (x, y);
}

issues bogus sorry diagnostics, while simpler testcases are handled just fine:
extern int foo (const char *, int);
extern int baz (const char *, int);

extern inline __attribute__ ((always_inline, gnu_inline)) int
baz (const char *x, int y)
{
  return 2;
}

int
baz (const char *x, int y)
{
  return 1;
}

int xa, xb;

static int
inl (const char *x, int y)
{
  return baz (x, y);
}

int
foo (const char *x, int y)
{
  return inl (x, y);
}

When a gnu_inline (or extern inline gnu89) function has a real is redefined, we
don't want any inlining for that function even if it is always_inline, at least
GCC always behaved that way and even on the simpler testcase behaves that way.
Even the original testcase works just fine with GCC 3.2.x, so this is a
regression.  On the trunk it is enough to e.g. remove one of the 3 baz calls in
inl and it compiles just fine (none of the baz calls is inlined as expected),
but
e.g. on 4.1 branch the compilation still fails.

arts hits this problem when building against recent glibcs.


-- 
           Summary: [4.1/4.2/4.3 Regression] Bogus inlining failed in call
                    to `xxx': redefined extern inline functions are not
                    considered for inlining
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 23+ messages in thread
[parent not found: <bug-33763-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2011-03-11 22:16 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-13 19:15 [Bug tree-optimization/33763] New: [4.1/4.2/4.3 Regression] Bogus inlining failed in call to `xxx': redefined extern inline functions are not considered for inlining jakub at gcc dot gnu dot org
2007-10-14 10:26 ` [Bug tree-optimization/33763] " rguenth at gcc dot gnu dot org
2007-10-14 12:10 ` hubicka at gcc dot gnu dot org
2007-10-14 12:50 ` hubicka at gcc dot gnu dot org
2007-10-14 21:11 ` jakub at gcc dot gnu dot org
2007-11-05  2:48 ` mmitchel at gcc dot gnu dot org
2008-01-08 17:08 ` rguenth at gcc dot gnu dot org
2008-01-08 17:47 ` jakub at gcc dot gnu dot org
2008-01-08 18:02 ` rguenther at suse dot de
2008-01-12 14:16 ` hubicka at gcc dot gnu dot org
2008-01-12 16:23 ` rguenther at suse dot de
2008-02-01 17:00 ` jsm28 at gcc dot gnu dot org
2008-02-13 18:16 ` hubicka at gcc dot gnu dot org
2008-05-19 20:29 ` [Bug tree-optimization/33763] [4.1/4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
2008-07-04 22:52 ` [Bug tree-optimization/33763] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
2008-11-13 13:56 ` jakub at gcc dot gnu dot org
2009-03-31 20:13 ` [Bug tree-optimization/33763] [4.3/4.4/4.5 " jsm28 at gcc dot gnu dot org
2009-08-04 12:37 ` rguenth at gcc dot gnu dot org
2010-01-16  6:52 ` pinskia at gcc dot gnu dot org
2010-05-22 18:20 ` [Bug tree-optimization/33763] [4.3/4.4/4.5/4.6 " rguenth at gcc dot gnu dot org
     [not found] <bug-33763-4@http.gcc.gnu.org/bugzilla/>
2011-03-04 12:37 ` rguenth at gcc dot gnu.org
2011-03-05 12:45 ` hubicka at ucw dot cz
2011-03-11 22:16 ` pthaugen at gcc dot gnu.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).