source: branches/libc-0.6/testcase/weak/905main.c@ 3007

Last change on this file since 3007 was 1237, checked in by bird, 22 years ago

#905 testcase.

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.8 KB
Line 
1/* $Id: 905main.c 1237 2004-02-15 01:24:40Z bird $ */
2/** @file
3 *
4 * Testcase for but #905.
5 * The problem is the fixups generated for weak symbols, in particular
6 * the weak virtual function tables (i.e. an data array).
7 *
8 * InnoTek Systemberatung GmbH confidential
9 *
10 * Copyright (c) 2004 InnoTek Systemberatung GmbH
11 * Author: knut st. osmundsen <bird-srcspam@anduin.net>
12 *
13 * All Rights Reserved
14 *
15 */
16
17
18/*******************************************************************************
19* Global Variables *
20*******************************************************************************/
21int giFoo1 = 1; /* make sure we skip into the data segment. */
22
23/* weak arrays */
24#pragma weak gaiWeak1
25int gaiWeak1[10] = {0,1,2,3,4,5,6,7,8,9};
26#pragma weak gaiWeak2
27int gaiWeak2[10] = {0,1,2,3,4,5,6,7,8,9};
28/* controll array. */
29int gaiNotWeak[10] = {0,1,2,3,4,5,6,7,8,9};
30
31int giFoo2 = 1; /* make sure we skip into the data segment. */
32
33
34
35int main()
36{
37 int i;
38 int *pai;
39 int rcRet = 0;
40
41 i = gaiWeak1[2];
42 if (i != 2)
43 {
44 printf("gaiWeak1[2] == %d, expected 2.\n", i);
45 rcRet++;
46 }
47 i = gaiWeak2[2];
48 if (i != 2)
49 {
50 printf("gaiWeak2[2] == %d, expected 2.\n", i);
51 rcRet++;
52 }
53 i = gaiNotWeak[2];
54 if (i != 2)
55 {
56 printf("gaiNotWeak[2] == %d, expected 2.\n", i);
57 rcRet++;
58 }
59
60 pai = &gaiWeak1[5];
61 i = *pai;
62 if (i != 5)
63 {
64 printf("gaiWeak1[5] == %d, expected 5.\n", i);
65 rcRet++;
66 }
67 pai = &gaiWeak2[5];
68 i = *pai;
69 if (i != 5)
70 {
71 printf("gaiWeak2[5] == %d, expected 5.\n", i);
72 rcRet++;
73 }
74 pai = &gaiNotWeak[5];
75 i = *pai;
76 if (i != 5)
77 {
78 printf("gaiNotWeak[5] == %d, expected 5.\n", i);
79 rcRet++;
80 }
81
82 return rcRet;
83}
Note: See TracBrowser for help on using the repository browser.