summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/optimize3.C
blob: 3ec438494f8d4c7dcc71327803e217d0c979aae0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// { dg-do run  }
// { dg-options "-O2" }
// 
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 May 2001 <nathan@codesourcery.com>

// Bug 2936. We ICE'd on tree inlining a function with an anonymous
// union decl.

inline const unsigned char *Foo (const char *string)
{
  union
  {
    const char *p1;
    const unsigned char *p2;
  };
  p1 = 0;
  p2 = 0;


  p1 = string;
  return p2;
  
}

const unsigned char *Baz (const char *string)
{
  return Foo (string);
}

int main ()
{
  const char *string = "s";
  const unsigned char *result;

  result = Baz (string);
  return (static_cast <const void *> (result)
	  != static_cast <const void *> (string));
}