Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
October 12, 2022 [Issue 23409] ImportC: multiple usages of va_list produces garbage | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23409 --- Comment #1 from dave287091@gmail.com --- The D version also seg faults, so maybe D’s implementation of stdarg is buggy? import core.stdc.stdarg; import core.stdc.stdio; void printf10(const(char)* fmt, ...){ for(int i = 0; i < 10; i++){ va_list args; va_start(args, fmt); vprintf(fmt, args); va_end(args); } } int main(){ printf10("Hello %s\n".ptr, "world".ptr); return 0; } -- |
October 12, 2022 [Issue 23409] ImportC: multiple usages of va_list produces garbage | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23409 --- Comment #2 from dave287091@gmail.com --- (In reply to dave287091 from comment #1) > The D version also seg faults, so maybe D’s implementation of stdarg is buggy? > > import core.stdc.stdarg; > import core.stdc.stdio; > > void printf10(const(char)* fmt, ...){ > for(int i = 0; i < 10; i++){ > va_list args; > va_start(args, fmt); > vprintf(fmt, args); > va_end(args); > } > } > > int main(){ > printf10("Hello %s\n".ptr, "world".ptr); > return 0; > } Forgot the extern(C) on printf10, but it still is buggy: $ ./vap Hello world Hello Segmentation fault: 11 -- |
October 12, 2022 [Issue 23409] ImportC: multiple usages of va_list produces garbage | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23409 --- Comment #3 from dave287091@gmail.com --- It works with ldc (which probably just defers to the llvm intrinsic) so the dmd implementation of stdarg is wrong. This is not actually ImportC specific. -- |
December 17, 2022 [Issue 23409] ImportC: multiple usages of va_list produces garbage | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23409 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
May 14, 2023 [Issue 23409] ImportC: multiple usages of va_list produces garbage | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23409 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@digitalmars.com --- Comment #4 from Walter Bright <bugzilla@digitalmars.com> --- The problem probably has to do with putting va_start and va_end in a loop. I think it was written expecting it to be done only once. -- |
May 14, 2023 [Issue 23409] ImportC: multiple usages of va_list produces garbage | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23409 --- Comment #5 from dave287091@gmail.com --- (In reply to Walter Bright from comment #4) > The problem probably has to do with putting va_start and va_end in a loop. I think it was written expecting it to be done only once. The same problem occurs with manually unrolling the loop. -- |
May 23, 2023 [Issue 23409] ImportC: multiple usages of va_list produces garbage | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23409 --- Comment #6 from Walter Bright <bugzilla@digitalmars.com> --- ImportC uses the D implementation of va_list, so your deduction that the fault lies with the D implementation is most likely correct. -- |
May 23, 2023 [Issue 23409] ImportC: multiple usages of va_list produces garbage | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23409 Tim <tim.dlang@t-online.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tim.dlang@t-online.de See Also| |https://issues.dlang.org/sh | |ow_bug.cgi?id=21425 --- Comment #7 from Tim <tim.dlang@t-online.de> --- Here is a related issue for normal D: https://issues.dlang.org/show_bug.cgi?id=21425 -- |
May 24, 2023 [Issue 23409] ImportC: multiple usages of va_list produces garbage | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23409 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |DUPLICATE --- Comment #8 from Walter Bright <bugzilla@digitalmars.com> --- *** This issue has been marked as a duplicate of issue 21425 *** -- |
Copyright © 1999-2021 by the D Language Foundation