[Issue 2821] New: struct alignment inconsistent with C for { int, long }

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

   Summary: struct alignment inconsistent with C for { int, long }
   Product: D
   Version: 1.043
  Platform: PC
OS/Version: Linux
Status: NEW
  Keywords: wrong-code
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: bugzi...@digitalmars.com
ReportedBy: kamm-removet...@incasoftware.de


I couldn't find it in the spec right now, but as far as I remember D and C
structs are supposed to be aligned identically when the same types are used.

struct S {
  int i;
  long l;
}

In C (using gcc 4.1.2), the S.l.offsetof is 4 and the total size is 12. With
dmd the offsetof is 8 and the total size is 16.

Test code:
-- D code
import std.stdio;

struct S {
  int i;
  long l;
}

void main() {
  writefln("%d %d", S.sizeof, S.l.offsetof);
}
-- C code
#include 

struct S
{
  int i;
  long long l;
};

int main()
{
  struct S s;
  printf("%d %d\n", sizeof(s), (void*)&s.l - (void*)&s);
  return 1;
}
--


-- 



Re: Error building DMD under Syllable

2009-04-08 Thread Rohan

Sorry, I missed with group, could you move first message to d.D ?


Error building DMD under Syllable

2009-04-08 Thread Rohan

I tried to build DMD under Syllable, but I got next error:

Itk   -D_I86_=1   -DMARS=1   -DTARGET_LINUX=1   -D_DH  backend/evalu8. с 
ackend/evalu8.с:   In  function   'elem* evalu8(elem*)':
ackend/evalu8.с:602:   error:'_clear87'   was not  declared   in 
this   scope ackend/evalu8.с:2003:   error:   '_status87'   was not 
declared  in  this  scope ake:   ***  [evalu8.o]   Error  1


I don't know how to fix it :( who can help me? I tried to build dmd 1&2 
and dmd ported to freebsd - result is same.


[Issue 2356] array literal as non static initializer generates horribly inefficient code.

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


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

   What|Removed |Added

   Keywords|wrong-code  |performance




--- Comment #2 from clugd...@yahoo.com.au  2009-04-08 08:01 ---
This is a performance issue, not wrong-code.


-- 



[Issue 2355] is() doesn't resolve aliases before template matching

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


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

   What|Removed |Added

Summary|is() fails to recognize a   |is() doesn't resolve aliases
   |static array|before template matching




--- Comment #1 from clugd...@yahoo.com.au  2009-04-08 08:00 ---
Actually, the bug is not really a problem with static arrays. The problem is
just that is() isn't resolving aliases. If you replace 'size_t' with 'int' or
'uint', it works fine.
BTW the original code no longer works, since literals are now dynamic arrays,
not static arrays.

template IsStaticSmart(T) {
  static if (is( T E : E[S], int S))
enum IsStaticSmart = "true: " ~ E.stringof;
  else
enum IsStaticSmart = "false";
}

alias int AliasInt;

template IsStaticSmart2(T) {
  static if (is( T E : E[S], AliasInt S))
enum IsStaticSmart2 = "true: " ~ E.stringof;
  else
enum IsStaticSmart2 = "false";
}

char [3] z;

pragma(msg, IsStaticSmart!(typeof(z)));
pragma(msg, IsStaticSmart2!(typeof(z)));

DMD2.028 displays:
true: char
false


-- 



[Issue 2816] Sudden-death static assert is not very useful

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





--- Comment #6 from kamm-removet...@incasoftware.de  2009-04-08 07:43 
---
Created an attachment (id=318)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=318&action=view)
template instantiation trace patch

patch against DMD 1.043, superficially tested

Note that this originated as a hack and might have been possible without adding
tinst to Scope and TemplateInstance. There were discussions about including
only certain template instantiations in such a trace:
http://www.mail-archive.com/digitalmar...@puremagic.com/msg03614.html


-- 



[Issue 2318] flaw code generation building a function pointer table

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


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

   What|Removed |Added

   Severity|normal  |critical




--- Comment #1 from clugd...@yahoo.com.au  2009-04-08 07:42 ---
This also applies to D2.(DMD2.028).


-- 



[Issue 840] incorrect code generation for asm{fidv ST(1), ST;}

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


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||INVALID




--- Comment #2 from clugd...@yahoo.com.au  2009-04-08 05:05 ---
Actually, DMD is correct. Here's the output from the old DOS DEBUG.
-u 0100 0102
13A9:0100 DCF9  FDIVST(1),ST
13A9:0102 DCF1  FDIVR   ST(1),ST

The bug is in majority of *nix assemblers. Here's a link.
===

http://gcc.gnu.org/ml/gcc-bugs/2003-04/msg01454.html
-
   The SystemV/386 SVR3.2 assembler, and probably all AT&T derived
   ix86 Unix assemblers, generate floating point instructions with
   reversed source and destination registers in certain cases.
   Unfortunately, gcc and possibly many other programs use this
   reversed syntax, so we're stuck with it.

   eg. `fsub %st(3),%st' results in st = st - st(3) as expected, but
   `fsub %st,%st(3)' results in st(3) = st - st(3), rather than
   the expected st(3) = st(3) - st

   This happens with all the non-commutative arithmetic floating point
   operations with two register operands, where the source register is
   %st, and destination register is %st(i).  See FloatDR below.
--


-- 



Re: DMD returns -1073741819 despite success

2009-04-08 Thread A. Jung
Issue persists with DMD2.018.

Should I file this as a bug (?), or is anybody willing check this on a 
multicore machine and take care of it???


[Issue 1681] cast(real) ulong.max == 0

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


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED




-- 



[Issue 2559] bad code generation for enum arrays

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





--- Comment #3 from clugd...@yahoo.com.au  2009-04-08 02:20 ---
Possible the same as bug 1884.


-- 



[Issue 2559] bad code generation for enum arrays

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


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

   What|Removed |Added

 CC||g...@nwawudu.com




--- Comment #2 from clugd...@yahoo.com.au  2009-04-08 02:09 ---
*** Bug 2792 has been marked as a duplicate of this bug. ***


-- 



[Issue 2559] bad code generation for enum arrays

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


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

   What|Removed |Added

   Severity|normal  |blocker
   Keywords||accepts-invalid
   Priority|P2  |P1
Summary|enum doesn't work properly  |bad code generation for enum
   |for invariant arrays|arrays




--- Comment #1 from clugd...@yahoo.com.au  2009-04-08 02:08 ---
I've changed the title, since I believe this bug is extremely serious.
Simpler example:
--
enum ubyte[4] a = [5,6,7,8];

void main()
{
  int x=3;
  assert(a[x]==7);
}
---
Interestingly, compiling with -O gives
bug.d(7): Error: variable a used before set

which shows that the initializer is being ignored.
My opinion is that that's correct -- the only reason you're using an enum is so
that it doesn't appear in the executable! Using a variable to index into the
enum is arguably equivalent to taking the address of the enum, and should
therefore be illegal -- use "immutable" instead.


-- 



[Issue 2792] Enum manifest constants and string produces errors

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


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||DUPLICATE




--- Comment #2 from clugd...@yahoo.com.au  2009-04-08 02:09 ---


*** This bug has been marked as a duplicate of 2559 ***


--