Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
fa2e34e8
Commit
fa2e34e8
authored
Feb 22, 2000
by
Mark Mitchell
Committed by
Mark Mitchell
Feb 22, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* g++.old-deja/g++.abi/ptrmem.C: New test.
From-SVN: r32107
parent
cfbad224
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
0 deletions
+107
-0
gcc/testsuite/ChangeLog
+4
-0
gcc/testsuite/g++.old-deja/g++.abi/ptrmem.C
+103
-0
No files found.
gcc/testsuite/ChangeLog
View file @
fa2e34e8
2000-02-22 Mark Mitchell <mark@codesourcery.com>
* g++.old-deja/g++.abi/ptrmem.C: New test.
2000-02-19 Richard Henderson <rth@cygnus.com>
* gcc.c-torture/compile/init-3.c: New.
...
...
gcc/testsuite/g++.old-deja/g++.abi/ptrmem.C
0 → 100644
View file @
fa2e34e8
// Special g++ Options: -fno-strict-aliasing
// Origin: Mark Mitchell <mark@codesourcery.com>
#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
// Check that pointers-to-member functions are represented correctly.
#include <cstddef>
struct
S
{
int
i
;
};
// Because S does not have a VPTR, it will not be a primary base of T,
// and will therefore end up at a non-zero offset.
struct
T
:
public
S
{
void
f
()
{}
virtual
void
g
()
{}
virtual
void
h
()
{}
};
// Provide access to the raw function pointers. This is
// mangling-dependent.
extern
"C"
void
f__1T
();
extern
"C"
void
g__1T
();
extern
"C"
void
h__1T
();
// This structure is a C representation of a pointer-to-member.
struct
ptrmemfunc
{
void
(
*
ptr
)
();
ptrdiff_t
adj
;
};
typedef
void
(
S
::*
sp
)();
typedef
void
(
T
::*
tp
)();
int
main
()
{
T
t
;
sp
x
;
tp
y
;
ptrmemfunc
*
xp
=
(
ptrmemfunc
*
)
&
x
;
ptrmemfunc
*
yp
=
(
ptrmemfunc
*
)
&
y
;
ptrdiff_t
delta
=
((
char
*
)
&
t
)
-
((
char
*
)
(
S
*
)
(
&
t
));
// Pointers-to-members should have the same size and alignment as
// the PTRMEMFUNC type.
if
(
sizeof
(
sp
)
!=
sizeof
(
ptrmemfunc
))
return
1
;
if
(
__alignof__
(
sp
)
!=
__alignof__
(
ptrmemfunc
))
return
2
;
// The NULL pointer-to-member should have a NULL first PTR field.
x
=
0
;
if
(
xp
->
ptr
!=
0
)
return
3
;
y
=
x
;
if
(
yp
->
ptr
!=
0
)
return
4
;
// A non-virtual function should have a pointer to the function.
// There should be no adjustment for the `T' version, and an
// appropriate adjustment for the `S' version.
y
=
&
T
::
f
;
if
(
yp
->
ptr
!=
&
f__1T
)
return
5
;
if
(
yp
->
adj
!=
0
)
return
6
;
x
=
(
sp
)
y
;
if
(
xp
->
ptr
!=
&
f__1T
)
return
7
;
if
(
xp
->
adj
!=
delta
)
return
8
;
// For a virtual function, we should see twice the vtable index,
// plus one. `T::h' is in the third slot: there's the RTTI entry,
// then the two virtual functions.
y
=
&
T
::
h
;
if
((
ptrdiff_t
)
yp
->
ptr
!=
7
)
return
9
;
if
(
yp
->
adj
!=
0
)
return
10
;
x
=
(
sp
)
y
;
if
((
ptrdiff_t
)
xp
->
ptr
!=
7
)
return
11
;
if
(
xp
->
adj
!=
delta
)
return
12
;
}
#else
/* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
int
main
()
{
}
#endif
/* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment