Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(241)

Issue 25460046: code review 25460046: [release-branch.go1.2] cmd/cgo: fix handling of array o... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 5 months ago by adg
Modified:
10 years, 5 months ago
Reviewers:
CC:
golang-dev
Visibility:
Public.

Description

[release-branch.go1.2] cmd/cgo: fix handling of array of pointers when using clang ««« CL 22840043 / e6794866ebeb cmd/cgo: fix handling of array of pointers when using clang Clang does not record the "size" field for pointer types, so we must insert the size ourselves. We were already doing this, but only for the case of pointer types. For an array of pointer types, the setting of the size for the nested pointer type was happening after the computation of the size of the array type, meaning that the array type was always computed as 0 bytes. Delay the size computation. This bug happens on all Clang systems, not just FreeBSD. Our test checked that cgo wrote something, not that it was correct. FreeBSD's default clang rejects array[0] as a C struct field, so it noticed the incorrect sizes. But the sizes were incorrect everywhere. Update testcdefs to check the output has the right semantics. Fixes issue 6292. R=golang-dev, iant CC=golang-dev https://codereview.appspot.com/22840043 »»»

Patch Set 1 #

Patch Set 2 : diff -r 897c9e1e3894 https://code.google.com/p/go #

Patch Set 3 : diff -r 897c9e1e3894 https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+80 lines, -15 lines) Patch
A misc/cgo/testcdefs/main.c View 1 1 chunk +48 lines, -0 lines 0 comments Download
M misc/cgo/testcdefs/main.go View 1 1 chunk +8 lines, -3 lines 0 comments Download
M misc/cgo/testcdefs/test.bash View 1 1 chunk +1 line, -1 line 0 comments Download
M src/cmd/cgo/gcc.go View 1 3 chunks +23 lines, -11 lines 0 comments Download

Messages

Total messages: 2
adg
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
10 years, 5 months ago (2013-11-13 03:33:22 UTC) #1
adg
10 years, 5 months ago (2013-11-13 03:33:47 UTC) #2
*** Submitted as https://code.google.com/p/go/source/detail?r=17f7c1339b79 ***

[release-branch.go1.2] cmd/cgo: fix handling of array of pointers when using
clang

««« CL 22840043 / e6794866ebeb
cmd/cgo: fix handling of array of pointers when using clang

Clang does not record the "size" field for pointer types,
so we must insert the size ourselves. We were already
doing this, but only for the case of pointer types.
For an array of pointer types, the setting of the size for
the nested pointer type was happening after the computation
of the size of the array type, meaning that the array type
was always computed as 0 bytes. Delay the size computation.

This bug happens on all Clang systems, not just FreeBSD.
Our test checked that cgo wrote something, not that it was correct.
FreeBSD's default clang rejects array[0] as a C struct field,
so it noticed the incorrect sizes. But the sizes were incorrect
everywhere.

Update testcdefs to check the output has the right semantics.

Fixes issue 6292.

R=golang-dev, iant
CC=golang-dev
https://codereview.appspot.com/22840043
»»»

R=golang-dev
CC=golang-dev
https://codereview.appspot.com/25460046
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b