mirror of
https://github.com/vlang/v.git
synced 2025-09-15 15:32:27 +03:00
compiler: fix linux crash
This commit is contained in:
parent
dfc7c9c00f
commit
57880aed18
1 changed files with 6 additions and 2 deletions
|
@ -2782,9 +2782,13 @@ fn (p mut Parser) array_init() string {
|
||||||
// Need to do this in the second pass, otherwise it goes to the very top of the out.c file
|
// Need to do this in the second pass, otherwise it goes to the very top of the out.c file
|
||||||
if !p.first_pass() {
|
if !p.first_pass() {
|
||||||
//if i == 0 {
|
//if i == 0 {
|
||||||
//////p.cgen.set_placeholder(new_arr_ph, '$new_arr($i, $i, sizeof($typ), ($typ[$i]) { 0 ')
|
//p.cgen.set_placeholder(new_arr_ph, '$new_arr($i, $i, sizeof($typ), ($typ[]) { 0 ')
|
||||||
//} else {
|
//} else {
|
||||||
p.cgen.set_placeholder(new_arr_ph, '$new_arr($i, $i, sizeof($typ), ($typ[$i]) { ')
|
// Due to a tcc bug, the length needs to be specified.
|
||||||
|
// GCC crashes if it is.
|
||||||
|
cast := if p.pref.ccompiler == 'tcc' { '($typ[$i])' } else { '($typ[])' }
|
||||||
|
p.cgen.set_placeholder(new_arr_ph,
|
||||||
|
'$new_arr($i, $i, sizeof($typ), $cast { ')
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
typ = 'array_$typ'
|
typ = 'array_$typ'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue