[Issue 21425] Using va_start twice results in wrong values

2023-05-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21425

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #3 from Dlang Bot  ---
@WalterBright created dlang/dmd pull request #15267 "fix Issue 21425 - Using
va_start twice results in wrong values" fixing this issue:

- fix Issue 21425 - Using va_start twice results in wrong values

https://github.com/dlang/dmd/pull/15267

--


[Issue 23934] Literal integer multiplication overflow is allowed in CTFE

2023-05-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23934

Luís Ferreira  changed:

   What|Removed |Added

 CC||cont...@lsferreira.net
   Hardware|x86_64  |All
 OS|Linux   |All
   Severity|enhancement |normal

--


[Issue 23934] Literal integer multiplication overflow is allowed in CTFE

2023-05-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23934

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #1 from Dlang Bot  ---
@ljmf00 created dlang/dmd pull request #15266 "constfold: multiplication should
check for overflow" fixing this issue:

- constfold: multiplication should check for overflow

  Fixes issue 23934.

  Signed-off-by: Luís Ferreira 

https://github.com/dlang/dmd/pull/15266

--


[Issue 23933] auto return type disables DIP1000 scope check

2023-05-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23933

Richard Cattermole  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||alphaglosi...@gmail.com
 Resolution|--- |INVALID

--- Comment #4 from Richard Cattermole  ---
The inference can be seen when you use auto instead of scope inside of
safeUsage when you output the AST.

```d
struct Struct
{
int* p;
@safe void hmm(int i)
{
}
}
```

vs with scope & auto:

```d
struct Struct
{
int* p;
auto pure nothrow @nogc @safe void hmm(int i)
{
}
}
```

I don't see a bug here. This looks to be working correctly. A method that was
not annotated with scope, used with scope, works when inference is turned on.
So I'm closing.

--


[Issue 23935] ImportC for libuv

2023-05-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23935

--- Comment #4 from a11e99z  ---
fixed manually. not checked yet with calling libuv from D, but dmd gives
uv9.obj.

MSVC command:
cl.exe -P -Fiuv.i -DUSING_UV_SHARED -DWIN32_LEAN_AND_MEAN -D__int64="long long"
-D__int32="long" -D__cdecl="" -D__inline="inline" -D__forceinline="inline"
-D__ptr64="" -D__ptr32="" -D__unaligned="" -D_CRT_SECURE_NO_WARNINGS /std:c11
uv.h

and fixing is:
1) changed
typedef struct __declspec(align(16)) __pragma(warning(push))
__pragma(warning(disable:4845)) __declspec(no_init_all) __pragma(warning(pop))
_CONTEXT { ... } CONTEXT, *PCONTEXT;

with issues:
uv9.i(4529): Error: missing tag `identifier` after `struct`
   
 
uv9.i(4529): Error: identifier or `(` expected 
   
 
uv9.i(4598): Error: no type for declarator before `}`  
   
 
uv9.i(4598): Error: no type-specifier for declarator

to:
typedef struct /*__declspec(align(16)) __pragma(warning(push))
__pragma(warning(disable:4845)) __declspec(no_init_all)
__pragma(warning(pop))*/ _CONTEXT { ... } CONTEXT __attribute__((aligned(
16))), *PCONTEXT;

2) removed '\' (no-line-break here)

with issues:
uv9.i(19384): Error: character '\' is not a valid token
   
 
uv9.i(19385): Error: character '\' is not a valid token

(2) should be fixed 100%
(1) hmm, struct attrs should be reordered?

--


[Issue 23935] ImportC for libuv

2023-05-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23935

--- Comment #3 from a11e99z  ---
still fixing issues manually
hint: '\' means code follows on next line w/o line break
todo: ignore it in parser?

--


[Issue 23935] ImportC for libuv

2023-05-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23935

a11e99z  changed:

   What|Removed |Added

   Attachment #1875|0   |1
is obsolete||

--- Comment #2 from a11e99z  ---
Created attachment 1876
  --> https://issues.dlang.org/attachment.cgi?id=1876&action=edit
comressed uv9.i after fixing some issues

preprocessed header with command:
cl.exe -P -Fiuv.i -DUSING_UV_SHARED -DWIN32_LEAN_AND_MEAN -D__int64="long long"
-D__int32="long" -D__cdecl="" -D__inline="inline" -D__forceinline="inline"
-D__ptr64="" -D__ptr32="" -D__unaligned="" /std:c11 uv.h

--


[Issue 23935] ImportC for libuv

2023-05-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23935

--- Comment #1 from a11e99z  ---
so 1st simple step:
dmd/importc can not eat unsigned __intXX:
typedef unsigned __int64  uintptr_t;
gives:
Error: missing comma or semicolon after declaration of `__anonymous`, found
`uintptr_t` instead

--


[Issue 23935] New: ImportC for libuv

2023-05-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23935

  Issue ID: 23935
   Summary: ImportC for libuv
   Product: D
   Version: D2
  Hardware: x86_64
OS: Windows
Status: NEW
  Severity: major
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: blac...@bk.ru

Created attachment 1875
  --> https://issues.dlang.org/attachment.cgi?id=1875&action=edit
proceeded uv9.i

1) I compiled uv.dll with vcpkg

2) I preprocessed "uv.h" (all libuv stuff) with command MSVC:
cl.exe -P -Fiuv.i -DUSING_UV_SHARED -DWIN32_LEAN_AND_MEAN uv.h
and got uv.i

3) I removed empty/#pragma/#line lines from the last one with commands:
@findstr /v /r /c:"^[ \x09]*$" /c:"^$" uv.i >uv2.i
@findstr /v /r /c:"^.*#line" uv2.i >uv3.i
@findstr /v /r /c:"^.*#pragma warning" /c:"^.*#pragma once" /c:"^.*#pragma
region" /c:"^.*#pragma endregion" uv3.i >uv9.i
and got uv9.i ~1MB (in attachments)

4) dmd/ldc2 -c uv9.i gives to me many issues:
uv9.i(2): Error: missing comma or semicolon after declaration of `__anonymous`,
found `uintptr_t` instead  
══uv9.i(4):
Error: identifier or `(` expected  
   
   Euv9.i(7): Error:
missing comma or semicolon after declaration of `__anonymous`, found `size_t`
instead
 rruv9.i(12): Error:
identifier or `(` expected

first 12LOC of uv9.i:
#pragma pack(push, 8)
typedef unsigned __int64  uintptr_t;
typedef char* va_list;
void __cdecl __va_start(va_list* , ...);
#pragma pack(pop)
__pragma(pack(push, 8))
typedef unsigned __int64 size_t;
typedef __int64  ptrdiff_t;
typedef __int64  intptr_t;
typedef _Bool __vcrt_bool;
typedef unsigned short wchar_t;

--


[Issue 23933] auto return type disables DIP1000 scope check

2023-05-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23933

--- Comment #3 from RazvanN  ---
So, if we enable attribute inference for all functions that have a body, this
will be fixed as a consequence. Or, the workaround would be to manually
annotate `hmm` as scope.

--


[Issue 23933] auto return type disables DIP1000 scope check

2023-05-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23933

--- Comment #2 from RazvanN  ---
[...] for auto functions because a function body needs to be present*

--


[Issue 23933] auto return type disables DIP1000 scope check

2023-05-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23933

RazvanN  changed:

   What|Removed |Added

 CC||razvan.nitu1...@gmail.com

--- Comment #1 from RazvanN  ---
Under the current specification this is not a bug, even though the behavior is
surprising. Attributes are inferred for auto functions because you a function
body needs to be present. Attributes are not inferred for non-auto functions,
even if the body is present.

--


[Issue 23934] New: Literal integer multiplication overflow is allowed in CTFE

2023-05-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23934

  Issue ID: 23934
   Summary: Literal integer multiplication overflow is allowed in
CTFE
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: e...@weka.io

This example program generates the following assertion failure:

  static assert(1000*1000*1000*1000 > 0); // Error: static assert:  `-727379968
> 0` is false

It would detect bugs earlier if constant-folding/CTFE execution of
multiplication disallowed overflow.

--


[Issue 23933] auto return type disables DIP1000 scope check

2023-05-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23933

Atila Neves  changed:

   What|Removed |Added

   Keywords||accepts-invalid, safe

--


[Issue 23933] New: auto return type disables DIP1000 scope check

2023-05-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23933

  Issue ID: 23933
   Summary: auto return type disables DIP1000 scope check
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: atila.ne...@gmail.com

This fails to compile with -preview=dip1000:

---
struct Struct {
int* p;
void hmm(int i) @safe { }
}

void safeUsage() @safe {
int i;
scope s = Struct();
s.hmm(42);
}
---
bug.d(9): Error: scope variable `s` assigned to non-scope parameter `this`
calling `hmm`



But changing `hmm`'s return type to `auto` makes the error go away.

--