Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
RefinedC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Iris
RefinedC
Commits
c286acff
Commit
c286acff
authored
4 years ago
by
Michael Sammler
Browse files
Options
Downloads
Patches
Plain Diff
small tweaks to container of examples
parent
a889efa0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#41625
passed
4 years ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/container_of.c
+2
-2
2 additions, 2 deletions
examples/container_of.c
examples/proofs/container_of/generated_code.v
+29
-30
29 additions, 30 deletions
examples/proofs/container_of/generated_code.v
with
31 additions
and
32 deletions
examples/container_of.c
+
2
−
2
View file @
c286acff
#define container_of(ptr, type, member) (type *)( (char *)(ptr) - offsetof(type,member) )
#define container_of(ptr, type, member) (type *)( (
unsigned
char *)(ptr) - offsetof(type,member) )
struct
test
{
int
a
;
...
...
@@ -13,5 +13,5 @@ int container_of_test() {
*
b
=
3
;
struct
test
*
pt
=
container_of
(
b
,
struct
test
,
b
);
pt
->
a
=
4
;
return
pt
->
a
;
return
t
.
a
;
}
This diff is collapsed.
Click to expand it.
examples/proofs/container_of/generated_code.v
+
29
−
30
View file @
c286acff
...
...
@@ -11,30 +11,29 @@ Section code.
Definition
loc_4
:
location_info
:=
LocationInfo
file_0
13
2
13
9
.
Definition
loc_5
:
location_info
:=
LocationInfo
file_0
14
2
14
77
.
Definition
loc_6
:
location_info
:=
LocationInfo
file_0
15
2
15
12
.
Definition
loc_7
:
location_info
:=
LocationInfo
file_0
16
2
16
1
5
.
Definition
loc_8
:
location_info
:=
LocationInfo
file_0
16
9
16
1
4
.
Definition
loc_9
:
location_info
:=
LocationInfo
file_0
16
9
16
1
4
.
Definition
loc_10
:
location_info
:=
LocationInfo
file_0
16
9
16
1
1
.
Definition
loc_11
:
location_info
:=
LocationInfo
file_0
1
6
9
16
11
.
Definition
loc_12
:
location_info
:=
LocationInfo
file_0
15
2
15
7
.
Definition
loc_7
:
location_info
:=
LocationInfo
file_0
16
2
16
1
3
.
Definition
loc_8
:
location_info
:=
LocationInfo
file_0
16
9
16
1
2
.
Definition
loc_9
:
location_info
:=
LocationInfo
file_0
16
9
16
1
2
.
Definition
loc_10
:
location_info
:=
LocationInfo
file_0
16
9
16
1
0
.
Definition
loc_11
:
location_info
:=
LocationInfo
file_0
1
5
2
15
7
.
Definition
loc_12
:
location_info
:=
LocationInfo
file_0
15
2
15
4
.
Definition
loc_13
:
location_info
:=
LocationInfo
file_0
15
2
15
4
.
Definition
loc_14
:
location_info
:=
LocationInfo
file_0
15
2
15
4
.
Definition
loc_15
:
location_info
:=
LocationInfo
file_0
1
5
10
15
11
.
Definition
loc_16
:
location_info
:=
LocationInfo
file_0
14
20
14
76
.
Definition
loc_17
:
location_info
:=
LocationInfo
file_0
14
3
5
14
76
.
Definition
loc_18
:
location_info
:=
LocationInfo
file_0
14
37
14
48
.
Definition
loc_14
:
location_info
:=
LocationInfo
file_0
15
10
15
11
.
Definition
loc_15
:
location_info
:=
LocationInfo
file_0
1
4
20
14
76
.
Definition
loc_16
:
location_info
:=
LocationInfo
file_0
14
35
14
76
.
Definition
loc_17
:
location_info
:=
LocationInfo
file_0
14
3
7
14
48
.
Definition
loc_18
:
location_info
:=
LocationInfo
file_0
14
45
14
48
.
Definition
loc_19
:
location_info
:=
LocationInfo
file_0
14
45
14
48
.
Definition
loc_20
:
location_info
:=
LocationInfo
file_0
14
4
5
14
4
8
.
Definition
loc_2
1
:
location_info
:=
LocationInfo
file_0
1
4
51
14
7
4
.
Definition
loc_24
:
location_info
:=
LocationInfo
file_0
13
2
13
4
.
Definition
loc_20
:
location_info
:=
LocationInfo
file_0
14
5
1
14
7
4
.
Definition
loc_2
3
:
location_info
:=
LocationInfo
file_0
1
3
2
13
4
.
Definition
loc_24
:
location_info
:=
LocationInfo
file_0
13
3
13
4
.
Definition
loc_25
:
location_info
:=
LocationInfo
file_0
13
3
13
4
.
Definition
loc_26
:
location_info
:=
LocationInfo
file_0
13
3
13
4
.
Definition
loc_27
:
location_info
:=
LocationInfo
file_0
13
7
13
8
.
Definition
loc_28
:
location_info
:=
LocationInfo
file_0
12
11
12
15
.
Definition
loc_29
:
location_info
:=
LocationInfo
file_0
12
12
12
15
.
Definition
loc_30
:
location_info
:=
LocationInfo
file_0
12
12
12
13
.
Definition
loc_34
:
location_info
:=
LocationInfo
file_0
11
24
11
25
.
Definition
loc_35
:
location_info
:=
LocationInfo
file_0
11
32
11
33
.
Definition
loc_26
:
location_info
:=
LocationInfo
file_0
13
7
13
8
.
Definition
loc_27
:
location_info
:=
LocationInfo
file_0
12
11
12
15
.
Definition
loc_28
:
location_info
:=
LocationInfo
file_0
12
12
12
15
.
Definition
loc_29
:
location_info
:=
LocationInfo
file_0
12
12
12
13
.
Definition
loc_33
:
location_info
:=
LocationInfo
file_0
11
24
11
25
.
Definition
loc_34
:
location_info
:=
LocationInfo
file_0
11
32
11
33
.
(* Definition of struct [test]. *)
Program
Definition
struct_test
:=
{|
...
...
@@ -59,21 +58,21 @@ Section code.
<
[
"#0"
:=
"t"
<-
{
layout_of
struct_test
}
StructInit
struct_test
[
(
"a"
,
LocInfoE
loc_3
4
(
i2v
1
i32
)
:
expr
)
;
(
"b"
,
LocInfoE
loc_3
5
(
i2v
2
i32
)
:
expr
)
(
"a"
,
LocInfoE
loc_3
3
(
i2v
1
i32
)
:
expr
)
;
(
"b"
,
LocInfoE
loc_3
4
(
i2v
2
i32
)
:
expr
)
]
;
"b"
<-
{
void
*
}
LocInfoE
loc_2
8
(
&
(
LocInfoE
loc_2
9
((
LocInfoE
loc_
30
(
"t"
))
at
{
struct_test
}
"b"
)))
;
LocInfoE
loc_2
7
(
&
(
LocInfoE
loc_2
8
((
LocInfoE
loc_
29
(
"t"
))
at
{
struct_test
}
"b"
)))
;
locinfo
:
loc_4
;
LocInfoE
loc_2
5
(
!
{
void
*
}
(
LocInfoE
loc_2
6
(
"b"
)))
<-
{
it_layout
i32
}
LocInfoE
loc_2
7
(
i2v
3
i32
)
;
LocInfoE
loc_2
4
(
!
{
void
*
}
(
LocInfoE
loc_2
5
(
"b"
)))
<-
{
it_layout
i32
}
LocInfoE
loc_2
6
(
i2v
3
i32
)
;
"pt"
<-
{
void
*
}
LocInfoE
loc_1
6
(
UnOp
(
CastOp
$
PtrOp
)
(
PtrOp
)
(
LocInfoE
loc_1
7
((
LocInfoE
loc_1
8
(
UnOp
(
CastOp
$
PtrOp
)
(
PtrOp
)
(
LocInfoE
loc_1
9
(
use
{
void
*
}
(
LocInfoE
loc_
20
(
"b"
))))))
at_neg_offset
{
it_layout
u8
,
PtrOp
,
IntOp
size_t
}
(
LocInfoE
loc_2
1
((
OffsetOf
(
struct_test
)
(
"b"
)))))))
;
LocInfoE
loc_1
5
(
UnOp
(
CastOp
$
PtrOp
)
(
PtrOp
)
(
LocInfoE
loc_1
6
((
LocInfoE
loc_1
7
(
UnOp
(
CastOp
$
PtrOp
)
(
PtrOp
)
(
LocInfoE
loc_1
8
(
use
{
void
*
}
(
LocInfoE
loc_
19
(
"b"
))))))
at_neg_offset
{
it_layout
u8
,
PtrOp
,
IntOp
size_t
}
(
LocInfoE
loc_2
0
((
OffsetOf
(
struct_test
)
(
"b"
)))))))
;
locinfo
:
loc_6
;
LocInfoE
loc_1
2
((
LocInfoE
loc_1
3
(
!
{
void
*
}
(
LocInfoE
loc_1
4
(
"pt"
))))
at
{
struct_test
}
"a"
)
<-
{
it_layout
i32
}
LocInfoE
loc_1
5
(
i2v
4
i32
)
;
LocInfoE
loc_1
1
((
LocInfoE
loc_1
2
(
!
{
void
*
}
(
LocInfoE
loc_1
3
(
"pt"
))))
at
{
struct_test
}
"a"
)
<-
{
it_layout
i32
}
LocInfoE
loc_1
4
(
i2v
4
i32
)
;
locinfo
:
loc_7
;
Return
(
LocInfoE
loc_8
(
use
{
it_layout
i32
}
(
LocInfoE
loc_9
((
LocInfoE
loc_10
(
!
{
void
*
}
(
LocInfoE
loc_11
(
"pt"
))
))
at
{
struct_test
}
"a"
))))
Return
(
LocInfoE
loc_8
(
use
{
it_layout
i32
}
(
LocInfoE
loc_9
((
LocInfoE
loc_10
(
"t"
))
at
{
struct_test
}
"a"
))))
]
>
$∅
)
%
E
|}
.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment