Opened 4 years ago

#138 new defect

Reference parameter in constructor with "new" initialization

Reported by: pabuhr Owned by:
Priority: minor Component: cfa-cc
Version: 1.0 Keywords:


This works if I change the cluster parameter from reference to pointer.

#include <stdlib.hfa>

struct cluster {
   unsigned int nthreads;

struct Worker {};

void ?{}( Worker & worker, cluster & wc ) {} // change to pointer

int main() {
   cluster * clust;
   Worker * fred = new( *clust ); // remove dereference

@plg2[17]% a.out
Cforall Runtime error (UNIX pid:11897) Addressing invalid memory at location (nil)
Possible cause is reading outside the address space or writing to a protected area within the address space with an invalid pointer or subscript.
Error occurred while executing thread Main Thread (0x7fa1f0add080).
Stack back trace for: /u0/pabuhr/software/cfa-cc/lib/cfa/x64-debug/
(0) a.out : _X4mainFi___1 + 0xa0  [0x400b5a]
Abort (core dumped)

Change History (0)

Note: See TracTickets for help on using tickets.