OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [weak/] [weak-14.c] - Blame information for rev 749

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
// { dg-do run }
2
// { dg-require-weak "" }
3
// { dg-require-alias "" }
4
// { dg-options "-O2 -fno-common" }
5
 
6
// Copyright 2005 Free Software Foundation, Inc.
7
// Contributed by Alexandre Oliva <aoliva@redhat.com>
8
 
9
// PR middle-end/24295
10
 
11
// The unit-at-a-time call graph code used to fail to emit variables
12
// without external linkage that were only used indirectly, through
13
// aliases.  We might then get linker failures because the static
14
// variable was not defined, or run-time errors because the weak alias
15
// ended up pointing somewhere random.
16
 
17
#include <stdlib.h>
18
 
19
static unsigned long lv1 = 0xdeadbeefUL;
20
#pragma weak Av1a = lv1
21
extern unsigned long Av1a;
22
 
23
static unsigned long lf1(void) { return 0x510bea7UL; }
24
#pragma weak Af1a = lf1
25
extern unsigned long Af1a(void);
26
 
27
int main (void) {
28
  if (! &Av1a
29
      || ! &Af1a
30
      || Av1a != 0xdeadbeefUL
31
      || Af1a() != 0x510bea7UL)
32
    abort ();
33
  exit (0);
34
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.