# nvcc internal error

**URL:** <https://forums.developer.nvidia.com/t/nvcc-internal-error/11389>\
**Category:** CUDA Programming and Performance\
**Created:** [August 5, 2009, 9:08pm UTC](https://forums.developer.nvidia.com/t/nvcc-internal-error/11389 "2009-08-05T21:08:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![peastman](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@peastman](https://forums.developer.nvidia.com/u/peastman)\
**Post date:** [August 5, 2009, 9:08pm UTC](https://forums.developer.nvidia.com/t/nvcc-internal-error/11389/1 "2009-08-05T21:08:02Z")

</div>

I’m getting the following error while trying to compile some code with CUDA 2.3 on OS X:

### Assertion failure at line 123 of ../../be/cg/NVISA/expand.cxx:

### Compiler Error in file /tmp/tmpxft\_000044d8\_00000000-7\_kCalculateCustomNonbondedForces.cpp3.i during Code\_Expansion phase:

### unexpected mtype

nvopencc INTERNAL ERROR: /usr/local/cuda/bin/../open64/lib//be returned non-zero status 1

The error seems to be triggered by the following piece of code:

[codebox]float value = 0.0f;

switch (expression-\>op[i])

{

```
case CONSTANT:

    value = expression->arg[i];

    break;

case VARIABLE1:

    value = vars1.x;

    break;

case VARIABLE2:

    value = vars1.y;

    break;

```

… lots more cases …

}

[/codebox]

If I comment out either the VARIABLE1 or VARIABLE2 case, it compiles correctly. Having two different case statements that refer to different elements of vars1 (which is a float4) produces the error. Unfortunately, that’s essential for me. Any suggestions for workarounds?

Peter

---

<div class="post-metadata">

**Author:** ![mikle](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mikle](https://forums.developer.nvidia.com/u/mikle)\
**Post date:** [August 7, 2009, 12:03pm UTC](https://forums.developer.nvidia.com/t/nvcc-internal-error/11389/2 "2009-08-07T12:03:11Z")

</div>

According to my experience, such error occurs when you attempt to assign the value from uninitialized variable to a variable in global memory. I.e.

**device** some\_type Arr[5];

**global** void t(){  
some\_type a;  
Arr[2] = a;  
}

may cause this error.

Unfortunately the error message is useless in this case; I’ve spent several days to understand what’s going on.

Mikle.

---

<div class="post-metadata">

**Author:** ![peastman](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@peastman](https://forums.developer.nvidia.com/u/peastman)\
**Post date:** [August 7, 2009, 11:27pm UTC](https://forums.developer.nvidia.com/t/nvcc-internal-error/11389/3 "2009-08-07T23:27:03Z")

</div>

> [@](#):
>
> According to my experience, such error occurs when you attempt to assign the value from uninitialized variable to a variable in global memory. I.e.

You were absolutely right! I was assigning the value to shared memory, not global memory, but initializing the source variable made the error go away.

Perhaps the compiler could be made to give a slightly more useful error message… :)

Peter

---

<div class="post-metadata">

**Author:** ![mikemoik](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mikemoik](https://forums.developer.nvidia.com/u/mikemoik)\
**Post date:** [February 26, 2010, 3:30pm UTC](https://forums.developer.nvidia.com/t/nvcc-internal-error/11389/4 "2010-02-26T15:30:58Z")

</div>

TOTALLY WEIRD with nvcc 2.3!

```auto
__device__ void d_func(float4& descr)

{

   descr.x = 1.0f; // write data to reference, but no read!

}

__global__ void kernel1()

{

   float4 descr;

   d_func1(descr);

}

__global__ void kernel2()

{

   float4 descr;

   d_func1(descr);

}

```

this code compiles with nvcc 2.2 but NOT with 2.3 giving the error mentioned here.

following code compiles (only altering kernel2, so weird):

```auto
__device__ void d_func(float4& descr)

{

   descr.x = 1.0f; // write data to reference, but no read!

}

__global__ void kernel1()

{

   float4 descr;

   d_func1(descr);

}

__global__ void kernel2()

{

   float4 descr;

   descr.y = 0.0f; // .x still remains unset

   d_func1(descr);

}

```

unusable!

---

<div class="post-metadata">

**Author:** ![mikemoik](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mikemoik](https://forums.developer.nvidia.com/u/mikemoik)\
**Post date:** [February 26, 2010, 3:55pm UTC](https://forums.developer.nvidia.com/t/nvcc-internal-error/11389/5 "2010-02-26T15:55:00Z")

</div>

NOT ONLY OS X specific! also linux …  
… so maybe move this thread!

---

<div class="post-metadata">

**Author:** ![sarostru](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@sarostru](https://forums.developer.nvidia.com/u/sarostru)\
**Post date:** [March 29, 2010, 4:17pm UTC](https://forums.developer.nvidia.com/t/nvcc-internal-error/11389/6 "2010-03-29T16:17:27Z")

</div>

I just encountered the same thing on a linux system with only 2.3.  
It may be fixed in 3.0 though since the same code had compiled fine on a system with the latest compiler
