Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0dc7484

Browse files
cmd/cgo: fix unaligned arguments typedmemmove crash on iOS
Irregularly typedmemmove and bulkBarrierPreWrite crashes on unaligned arguments. By aligning the arguments this is fixed. Fixes #46893
1 parent b2960e3 commit 0dc7484

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎src/cmd/cgo/out.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,7 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
10511051
// string.h for memset, and is also robust to C++
10521052
// types with constructors. Both GCC and LLVM optimize
10531053
// this into just zeroing _cgo_a.
1054-
fmt.Fprintf(fgcc, "\ttypedef %s %v _cgo_argtype;\n", ctype.String(), p.packedAttribute())
1054+
fmt.Fprintf(fgcc, "\ttypedef %s %v __attribute__((aligned(%d))) _cgo_argtype;\n", ctype.String(), p.packedAttribute(), p.PtrSize)
10551055
fmt.Fprintf(fgcc, "\tstatic _cgo_argtype _cgo_zero;\n")
10561056
fmt.Fprintf(fgcc, "\t_cgo_argtype _cgo_a = _cgo_zero;\n")
10571057
if gccResult != "void" && (len(fntype.Results.List) > 1 || len(fntype.Results.List[0].Names) > 1) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /