[Issue 24275] pragma(mangle, ...) can hijack safe functions, bypassing @safe checks

2023-12-08 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24275

timon.g...@gmx.ch changed:

   What|Removed |Added

   Severity|enhancement |normal

--


[Issue 24275] New: pragma(mangle, ...) can hijack safe functions, bypassing @safe checks

2023-12-08 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24275

  Issue ID: 24275
   Summary: pragma(mangle, ...) can hijack safe functions,
bypassing @safe checks
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Keywords: safe
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: timon.g...@gmx.ch

DMD 2.106.0:

```d
@safe:
import std.stdio;
pragma(mangle,bar.mangleof)
void foo()@system{
writeln("corrupted memory");
}
void bar()@safe{
writeln("beningn code");
}
void main()@safe{
bar();
}
```

Prints: "corrupted memory".

--


[Issue 12939] More uniform error messages for not nothrow and not @safe functions

2016-10-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12939

--- Comment #3 from github-bugzi...@puremagic.com ---
Commits pushed to stable at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/72e82e63d478b6f6d095255b020169a25b12154e
partially address Issue 12939

https://github.com/dlang/dmd/commit/35909fa6a77177147559255737517e041d4ff014
Merge pull request #5846 from WalterBright/fix12939

--


[Issue 16266] @safe functions may dereference non-dereferenceable pointers

2016-07-11 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16266

--- Comment #3 from Andrei Alexandrescu  ---
My bad

--


[Issue 16266] @safe functions may dereference non-dereferenceable pointers

2016-07-11 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16266

Walter Bright  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution|--- |DUPLICATE

--- Comment #2 from Walter Bright  ---


*** This issue has been marked as a duplicate of issue 11176 ***

--


[Issue 16266] @safe functions may dereference non-dereferenceable pointers

2016-07-11 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16266

Andrei Alexandrescu  changed:

   What|Removed |Added

   Keywords||safe

--


[Issue 16266] New: @safe functions may dereference non-dereferenceable pointers

2016-07-11 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16266

  Issue ID: 16266
   Summary: @safe functions may dereference non-dereferenceable
pointers
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: and...@erdani.com

Consider:


@safe
int foo(int *iPtr) {
return *iPtr;
}

@safe
int bar(int[] iSlice) {
return foo(iSlice.ptr);
}


@safe int[] baz(int[] a) {
return bar(a[$ .. $]; 
}

Calling baz with any array will end up passing a non-dereferenceable pointer to
foo. This corner case needs to be addressed. There are a few possibilities:

1. Simply disallow taking .ptr for any array in @safe code.

2. Insert a runtime check whenever array.ptr is passed into a @safe function
(array must be non-empty). 

3. Require flow, for example this could be made legal:

@safe
int bar(int[] iSlice) {
return iSlice.empty ? 42 : foo(iSlice.ptr);
}

Probably (2) would be the best all things considered.

--


[Issue 12939] More uniform error messages for not nothrow and not @safe functions

2016-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12939

--- Comment #2 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/72e82e63d478b6f6d095255b020169a25b12154e
partially address Issue 12939

https://github.com/dlang/dmd/commit/35909fa6a77177147559255737517e041d4ff014
Merge pull request #5846 from WalterBright/fix12939

partially address Issue 12939

--


[Issue 12939] More uniform error messages for not nothrow and not @safe functions

2016-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12939

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


[Issue 11466] std.range.zip for nothrow and @safe functions

2016-06-07 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11466

Walter Bright  changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com

--- Comment #7 from Walter Bright  ---
Since the @safe version compiles successfully, I'm going to remove the 'safe'
keyword and @safe from the title.

--


[Issue 12939] More uniform error messages for not nothrow and not @safe functions

2016-06-07 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12939

Walter Bright  changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com

--- Comment #1 from Walter Bright  ---
Partial fix:

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

--


[Issue 11466] std.range.zip for nothrow and @safe functions

2014-12-17 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11466

--- Comment #4 from hst...@quickfur.ath.cx ---
Zip.empty and Zip.popFront call enforce, which is not nothrow. This can't be
eliminated because the runtime length of the ranges passed to zip() is not
known, and zip() will throw an exception if unequal-length ranges are passed to
it.

I don't know how to resolve this, since the only way to make Zip nothrow is to
change enforce to assert, but that means you'll get array bounds violations at
runtime if the input arguments have unequal lengths.

--


[Issue 11466] std.range.zip for nothrow and @safe functions

2014-12-17 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11466

--- Comment #5 from bearophile_h...@eml.cc ---
(In reply to hsteoh from comment #4)

 zip() will throw an exception if unequal-length ranges are passed to it.

This is not true, this doesn't throw:

void main() {
import std.range: zip, StoppingPolicy;
int[] a = [1];
int[] b = [1, 2];
foreach (pair; zip(a, b)) {}
foreach (pair; zip(StoppingPolicy.shortest, a, b)) {}
foreach (pair; zip(StoppingPolicy.longest, a, b)) {}
}


Only this one throws:

void main() {
import std.range: zip, StoppingPolicy;
int[] a = [1];
int[] b = [1, 2];
foreach (pair; zip(StoppingPolicy.requireSameLength, a, b)) {}
}



 I don't know how to resolve this,

The solution is to give StoppingPolicy as template argument to zip() instead of
giving it as run-time value. This allows to specialize zip() at compile-time,
allowing zip() with StoppingPolicy.shortest (that is the default) and with
StoppingPolicy.longest to be nothrow. And leaving only the quite rarely used
zip() with StoppingPolicy.requireSameLength not nothrow.

For API compatibility you can even leave both ways to give StoppingPolicy to
zip, or you can slowly deprecate the old way.

--


[Issue 11466] std.range.zip for nothrow and @safe functions

2014-12-17 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11466

--- Comment #6 from hst...@quickfur.ath.cx ---
Good idea.

However, it will break compatibility with the current Zip struct, which
unfortunately is public so some user code out there may be naming it directly.
Looks like we'll have to introduce a different overload of Zip for the
compile-time StoppingPolicy variant. Code duplication galore. :-(

--


[Issue 11466] std.range.zip for nothrow and @safe functions

2014-12-04 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11466

--- Comment #1 from bearophile_h...@eml.cc ---
In dmd 2.067alpha this code compiles:


import std.range: zip;
void foo1(int[] data) @safe {
foreach (pair; zip(data, data)) {}
}
void foo2(in int[] data) @safe {
foreach (pair; zip(data, data)) {}
}
void main() {}

--


[Issue 11466] std.range.zip for nothrow and @safe functions

2014-12-04 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11466

--- Comment #2 from hst...@quickfur.ath.cx ---
So this bug can be closed?

--


[Issue 11466] std.range.zip for nothrow and @safe functions

2014-12-04 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11466

--- Comment #3 from bearophile_h...@eml.cc ---
(In reply to hsteoh from comment #2)
 So this bug can be closed?

No, it can't because this fails still:

import std.range: zip;
void main() nothrow {
foreach (p; zip([10], [20])) {}
}

--


[Issue 12939] More uniform error messages for not nothrow and not @safe functions

2014-06-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12939

hst...@quickfur.ath.cx changed:

   What|Removed |Added

 CC||hst...@quickfur.ath.cx

--


[Issue 11466] std.range.zip for nothrow and @safe functions

2014-06-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11466

hst...@quickfur.ath.cx changed:

   What|Removed |Added

 CC||hst...@quickfur.ath.cx

--


[Issue 12939] More uniform error messages for not nothrow and not @safe functions

2014-06-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12939

hst...@quickfur.ath.cx changed:

   What|Removed |Added

   Keywords||safe

--


[Issue 11466] std.range.zip for nothrow and @safe functions

2014-06-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11466

hst...@quickfur.ath.cx changed:

   What|Removed |Added

   Keywords||safe

--


[Issue 12939] New: More uniform error messages for not nothrow and not @safe functions

2014-06-17 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12939

  Issue ID: 12939
   Summary: More uniform error messages for not nothrow and not
@safe functions
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Keywords: diagnostic
  Severity: minor
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: bearophile_h...@eml.cc

void main() pure nothrow @safe @nogc {
import std.stdio;
writeln(1);
}



DMD 2.066alpha gives:

test.d(3,12): Error: pure function 'D main' cannot call impure function
'std.stdio.writeln!(int).writeln'
test.d(3,12): Error: safe function 'D main' cannot call system function
'std.stdio.writeln!(int).writeln'
test.d(3,12): Error: @nogc function 'D main' cannot call non-@nogc function
'std.stdio.writeln!(int).writeln'
test.d(3,12): Error: 'std.stdio.writeln!(int).writeln' is not nothrow
test.d(1,6): Error: function 'D main' is nothrow yet may throw


I suggest error messages like (note the different single error message for
nothrow, and the use of @safe/@system instead of safe/system):

test.d(3,12): Error: pure function 'D main' cannot call impure function
'std.stdio.writeln!(int).writeln'
test.d(3,12): Error: nothrow function 'D main' cannot call non-nothrow function
'std.stdio.writeln!(int).writeln'
test.d(3,12): Error: @safe function 'D main' cannot call @system function
'std.stdio.writeln!(int).writeln'
test.d(3,12): Error: @nogc function 'D main' cannot call non-@nogc function
'std.stdio.writeln!(int).writeln'


The error messages could even be compressed to reduce the noise:

test.d(3,12): Error: pure nothrow @safe @nogc function 'D main' cannot call
impure non-nothrow @system non-@nogc function 'std.stdio.writeln!(int).writeln'

--


[Issue 11466] New: std.range.zip for nothrow and @safe functions

2013-11-07 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11466

   Summary: std.range.zip for nothrow and @safe functions
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Keywords: rejects-valid
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2013-11-07 03:22:29 PST ---
import std.range: zip;
void main() nothrow {
foreach (p; zip([10], [20])) {}
}



dmd 2.064 gives me:

test.d(3): Error: 'std.range.Zip!(int[], int[]).Zip.empty' is not nothrow
test.d(3): Error: 'std.range.Zip!(int[], int[]).Zip.popFront' is not nothrow
test.d(2): Error: function 'D main' is nothrow yet may throw


I think that zip should work in a nothrow function.

- - - - - - - - - - -

Another example of the same problem:

import std.algorithm: reduce;
import std.range: zip;
void main() nothrow {
reduce!((a, b) = 1)(1, zip([10], [20]));
}



dmd gives:

test.d(4): Error: 'test.main.reduce!((a, b) = 1).reduce!(int, Zip!(int[],
int[])).reduce' is not nothrow
test.d(3): Error: function 'D main' is nothrow yet may throw

- - - - - - - - - - -

Another problem:

import std.range: zip;
void foo1(int[] data) @safe {
foreach (pair; zip(data, data)) {} // OK
}
void foo2(in int[] data) @safe {
foreach (pair; zip(data, data)) {} // Error
}
void main() {}



dmd gives:

test.d(6): Error: safe function 'test.foo2' cannot call system function
'std.range.Zip!(const(int)[], const(int)[]).Zip.front'

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 9918] Strange error: void initializers for pointers not allowed in safe functions

2013-08-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9918


Lars T. Kyllingstad bugzi...@kyllingen.net changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@kyllingen.net
 Resolution||DUPLICATE


--- Comment #1 from Lars T. Kyllingstad bugzi...@kyllingen.net 2013-08-04 
05:45:07 PDT ---
*** This issue has been marked as a duplicate of issue 6405 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 9918] New: Strang error: void initializers for pointers not allowed in safe functions

2013-04-11 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9918

   Summary: Strang error: void initializers for pointers not
allowed in safe functions
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic andrej.mitrov...@gmail.com 2013-04-11 
04:30:46 PDT ---
import std.path;

string joinPath(C)(const(C[])[] paths...) @safe pure
{
return buildNormalizedPath(buildPath(paths));
}

void main()
{
joinPath(foo, bar);
}

Using 2.063 git-head:

test.d(7): Error: variable test.joinPath!(char).joinPath.__arrayArg2219 void
initializers for pointers not allowed in safe functions

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 7803] Regression(2.054) scope(success) in nothrow/@safe functions causes compile errors

2012-12-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7803



--- Comment #7 from github-bugzi...@puremagic.com 2012-12-19 06:41:36 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/2926c0a493254efeaaff21fe920a00db58f46693
partially fix Issue 7803 - Regression(2.054) scope(success) in nothrow/@safe
functions causes compile errors

https://github.com/D-Programming-Language/dmd/commit/d6a2b1c95d8409e5e2ff0b60de64e2ee25283d96
Merge pull request #1388 from 9rnsr/fix7803

partially fix Issue 7803 - Regression(2.054) scope(success) in nothrow/@safe
functions causes compile errors

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 7803] Regression(2.054) scope(success) in nothrow/@safe functions causes compile errors

2012-12-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7803


Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #8 from Kenji Hara k.hara...@gmail.com 2012-12-19 17:25:29 PST ---
Now original code can be compiled as expected.

Different from bug 6278, the internal catch and re-throwing which used for
scope(success) do not affect to whole code semantics. So I mark this resolved
fixed.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 7803] Regression(2.054) scope(success) in nothrow/@safe functions causes compile errors

2012-12-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7803



--- Comment #9 from Kenji Hara k.hara...@gmail.com 2012-12-19 17:32:32 PST ---
(In reply to comment #8)
 Now original code can be compiled as expected.
 
 Different from bug 6278, the internal catch and re-throwing which used for
 scope(success) do not affect to whole code semantics. So I mark this resolved
 fixed.

But, there is still internal semantic inconsistency:
- Catching Throwable object in @safe code
- Re-throwing Throwable object in nothrow code

In these points, I couldn't resolve the issues cleanly...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 7803] Regression(2.054) scope(success) in nothrow/@safe functions causes compile errors

2012-12-18 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7803


Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||pull


--- Comment #6 from Kenji Hara k.hara...@gmail.com 2012-12-18 19:24:29 PST ---
https://github.com/D-Programming-Language/dmd/pull/1388

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 7803] Regression(2.054) scope(success) in nothrow/@safe functions causes compile errors

2012-07-29 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7803


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com


--- Comment #4 from Walter Bright bugzi...@digitalmars.com 2012-07-29 
14:56:44 PDT ---
Is this really a regression? When did it work?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 7803] Regression(2.054) scope(success) in nothrow/@safe functions causes compile errors

2012-07-29 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7803



--- Comment #5 from yebblies yebbl...@gmail.com 2012-07-30 12:34:27 EST ---
(In reply to comment #4)
 Is this really a regression? When did it work?

I haven't tested it, but I assume it is the same cause as issue 6278, and needs
the same fix (mark generated catches so they don't get checked for @safety.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 7803] Regression(2.054) scope(success) in nothrow/@safe functions causes compile errors

2012-07-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7803


yebblies yebbl...@gmail.com changed:

   What|Removed |Added

 CC||yebbl...@gmail.com
Summary|scope(success) in   |Regression(2.054)
   |nothrow/@safe functions |scope(success) in
   |causes compile errors   |nothrow/@safe functions
   ||causes compile errors
   Severity|normal  |regression


--- Comment #3 from yebblies yebbl...@gmail.com 2012-07-26 22:18:24 EST ---
I caused this by disallowing catch() in @safe code.  Much like issue 6278.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 7803] scope(success) in nothrow/@safe functions causes compile errors

2012-07-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7803


kekeni...@yahoo.co.jp changed:

   What|Removed |Added

 CC||kekeni...@yahoo.co.jp
   Severity|minor   |normal


--- Comment #2 from kekeni...@yahoo.co.jp 2012-07-20 17:30:10 PDT ---
To make matters worse, the error message misses its location information.

Raised the severity from 'minor'.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 7803] scope(success) in nothrow/@safe functions causes compile errors

2012-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7803


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

 CC||clugd...@yahoo.com.au


--- Comment #1 from Don clugd...@yahoo.com.au 2012-04-02 09:08:13 PDT ---
This is happening because

scope(success) { success_clause; }
...

gets transformed into:

try {
  ...
}
catch(Throwable t)
{
   success_clause;
   throw t;
}

Obviously the compiler shouldn't generate an error for code it wrote!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 7803] New: scope(success) in nothrow/@safe functions causes compile errors

2012-03-31 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7803

   Summary: scope(success) in nothrow/@safe functions causes
compile errors
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: minor
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: david.ecka...@sociomantic.com


--- Comment #0 from David Eckardt david.ecka...@sociomantic.com 2012-03-31 
05:19:31 PDT ---
Example code:

---
module test;

@safe int f() {
scope(success) {/* ... */}
return 3;
}

nothrow int g() {
scope(success) {/* ... */}
return 3;
}
---

DMD reports these compile-time errors:

Error: can only catch class objects derived from Exception in @safe code, not
'object.Throwable'

Error: object.Throwable is thrown but not caught test.d(8): Error: function
test.g 'g' is nothrow yet may throw

When using scope(exit) instead, the example code compiles successfully.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5415] @Safe functions not working

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5415


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution||FIXED


--- Comment #2 from Walter Bright bugzi...@digitalmars.com 2011-06-26 
16:26:53 PDT ---
https://github.com/D-Programming-Language/dmd/commit/952795ec69ad7d704c0848bb160521a435749c42

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4132] pointer arithmetic accepted in @safe functions

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4132


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution||FIXED


--- Comment #2 from Walter Bright bugzi...@digitalmars.com 2011-06-26 
16:27:15 PDT ---
https://github.com/D-Programming-Language/dmd/commit/952795ec69ad7d704c0848bb160521a435749c42

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4132] pointer arithmetic accepted in @safe functions

2011-06-11 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4132


yebblies yebbl...@gmail.com changed:

   What|Removed |Added

   Keywords||patch
 CC||yebbl...@gmail.com


--- Comment #1 from yebblies yebbl...@gmail.com 2011-06-11 07:36:19 PDT ---
https://github.com/D-Programming-Language/dmd/pull/109

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5415] @Safe functions not working

2011-06-11 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5415


yebblies yebbl...@gmail.com changed:

   What|Removed |Added

   Keywords||accepts-invalid, patch
 CC||yebbl...@gmail.com


--- Comment #1 from yebblies yebbl...@gmail.com 2011-06-11 07:36:56 PDT ---
https://github.com/D-Programming-Language/dmd/pull/109

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


@safe functions

2011-01-05 Thread Sean Eskapp
This is either a compiler bug, or outdated language documentation, but I'm
having some freedom with @safe functions:

* No casting from a pointer type to any type other than void*.
* No modification of pointer values.
* No taking the address of a local variable or function parameter.

I've attached code which does all three of these things, which compiles and 
runs.

Inline assembler was an error, as well as casting from integer to a pointer
type, but I didn't test anything else.

I'm using dmd2.exe as my compiler.
begin 644 main.d
M:6UP;W)T('-T9YS=1I;SL-@T*0'-a...@=f]i9!F;V\H:6YT('@I#0I[
M#0H):6YT($[#0H):6YT*B!Y(#T@)F$[(\O('1A:VEN9R!A91R97-S(]F
M(QO8V%L('9AFEA8FQE#0H)8VAABH@B`](-AW0H8VAABHI3...@+r\@
M8V%S=EN9R!P;VEN=5R('1O(YO;BUP;VEN=5R('1Y4-@DJB`](#0[
M(\O('=R:71I;F@=7-I;F@;6%L9F]R;65D('!O:6YT97(-@D-@EY(#T@
M)g...@[(\O('1A:VEN9R!A91R97-S(]F('!AF%M971Eb...@04y$(-H86YG
M:6YG('!O:6YT97(@=F%L=64-@DJ2`](#0[(\O(-H86YG:6YG('9A;'5E
M#0H)#0H):6YT((@/2!C87-T*EN=EY.R`O+R!C87-T:6YG(9R;VT@]I
M;G1EB!T7!E('1O('1Y4...@=AA=!IVXG=!V;v...@t*?0t*#0iv;VED
G(UA:6XH*0T*PT*6EN=!X(#...@-3`[#0h)9F]O*'@I.PT*?0T*
`
end


Re: @safe functions

2011-01-05 Thread Simen kjaeraas

Sean Eskapp eatingstap...@gmail.com wrote:

This is either a compiler bug, or outdated language documentation, but  
I'm

having some freedom with @safe functions:

* No casting from a pointer type to any type other than void*.
* No modification of pointer values.
* No taking the address of a local variable or function parameter.

I've attached code which does all three of these things, which compiles  
and runs.


Inline assembler was an error, as well as casting from integer to a  
pointer

type, but I didn't test anything else.

I'm using dmd2.exe as my compiler.


Safe-D is currently not implemented, at least in whole. Other issues
also have higher priority.

Also, this group is for automated messages from BugZilla. Please either
post these things as bugs[1] or in the digitalmars.D.learn of digitalmars.D
newsgroups.

[1]: http://d.puremagic.com/issues/enter_bug.cgi
--
Simen


Re: @safe functions

2011-01-05 Thread Lars T. Kyllingstad
On Wed, 05 Jan 2011 15:35:09 +, Sean Eskapp wrote:

 This is either a compiler bug, or outdated language documentation, but
 I'm having some freedom with @safe functions:
 
 * No casting from a pointer type to any type other than void*. * No
 modification of pointer values.
 * No taking the address of a local variable or function parameter.
 
 I've attached code which does all three of these things, which compiles
 and runs.
 
 Inline assembler was an error, as well as casting from integer to a
 pointer type, but I didn't test anything else.
 
 I'm using dmd2.exe as my compiler.
 import std.stdio;
 
 @safe void foo(int x)
 {
   int a;
   int* y = a; // taking address of local variable char* z =
   cast(char*)y; // casting pointer to non-pointer type *z = 4; // 
writing
   using malformed pointer
   
   y = x; // taking address of parameter, AND changing pointer 
value *y =
   4; // changing value
   
   int b = cast(int)y; // casting from pointer type to type that 
isn't
   void*
 }
 
 void main()
 {
   int x = 50;
   foo(x);
 }

Hi! This forum is just a feed from Bugzilla, it is not meant for 
discussions. Please file a bug report at http://d.puremagic.com/issues/ 
instead.

Thanks,
Lars


[Issue 5415] New: @Safe functions not working

2011-01-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5415

   Summary: @Safe functions not working
   Product: D
   Version: D2
  Platform: All
   URL: http://www.digitalmars.com/d/2.0/function.html#functio
n-safety
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: eatingstap...@gmail.com


--- Comment #0 from eatingstap...@gmail.com 2011-01-05 09:08:13 PST ---
Created an attachment (id=860)
Code showing features not working

This is either a compiler bug, or outdated language documentation, but I'm
having some freedom with @safe functions:

* No casting from a pointer type to any type other than void*.
* No modification of pointer values.
* No taking the address of a local variable or function parameter.

I've attached code which does all three of these things, which compiles and
runs.

Inline assembler was an error, as well as casting from integer to a pointer
type, but I didn't test anything else.

I'm using dmd2.exe as my compiler.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---