It seems like the combination of memory allocated with stdc's alloca() function and synchronized(this) [as shown in the outcommented code in the paste] cause an internal error in eh.c.
Neither a D-way copy ..
synchronized (this)
list[] = queueList;
..nor a memcpy..
synchronized (this)
memcpy (list.ptr, queueList.ptr, len * (QueueFile*).sizeof);
fixed this error.
It has been worked around via creating a synchronized copy method to perform the same action.
Comment #1 by bugzilla — 2007-07-12T18:06:25Z
Please provide a complete reproducible sample.
Comment #2 by clugdbug — 2009-05-26T01:00:32Z
Original title was:
Internal error: eh.c 41 - alloca & synchronized(this)
Comment #3 by clugdbug — 2009-07-10T00:03:11Z
As this has been open for 2 years without anyone providing a complete test case, I'm closing this as invalid. Reopen if you have a test case.
Comment #4 by dfj1esp02 — 2009-07-10T04:41:07Z
This can be a test case, I didn't check it for 1.018, it works on 2.031.
---
struct QueueFile{ int size,channel; }
class A
{
QueueFile[] queueList;
final synchronized void copy (QueueFile[] dst, QueueFile src[])
{
dst[] = src;
}
final void watchdog ()
{
auto len = queueList.length;
auto list = (cast(QueueFile*) alloca(len * QueueFile.sizeof))[0..len];
// clone the list of queues to avoid stalling everything
//copy (list, queueList);
synchronized (this)
memcpy (list.ptr, queueList.ptr, len * (QueueFile*).sizeof);
//list[] = queueList;
foreach (q; list)
{
if (q.size)
writeln (q.channel);
//if (q.isDirty)
//{
// q.flush;
// log.info ("flushed "~q.channel.name~" to disk");
//}
}
}
}
---
Comment #5 by braddr — 2009-07-10T10:35:03Z
Reopening so the new code can be looked at. However...
Term clarification 'it works on 2.031'? Does that mean that it compiles successfully or unsuccessfully? If unsuccessfully, with the same error? If it's not the same error, please include the current error message.
Comment #6 by dfj1esp02 — 2009-07-13T01:21:21Z
compiles successfully
Comment #7 by braddr — 2009-07-27T00:52:38Z
Reclosing.
If the new example code compiles, then it's not exactly a repro case for the bug, unless it failed to compile with an older version of the code. Without good info, I agree with Don's assessment.. might as well close it as an invalid bug report.