Segfault on two sequential cufft1D plans

I am fairly new to the CUDA programming environment and need some help with a current issue i couldn’t resolve. This is a extract from a larger program to duplicate the issue, it gives a segfault error and I have no idea where.

#include <cstdlib>
#include <vector>
#include <fstream>
#include <string>
#include <sstream>
#include <iostream>
#include <exception>
#include <cufft.h>

using namespace std;


int main(int argc, char** argv){

//prepare the fft
        int N = 4096;
        cufftHandle plan;
        cufftComplex *output;
        cufftHandle plan2;
        cufftComplex *output2;

        float * ppf_out1_d;
        cudaMalloc((void **) &ppf_out1_d,N*sizeof(float));
        cudaDeviceSynchronize();
        float * ppf_out2_d;
        cudaMalloc((void **) &ppf_out2_d,N*sizeof(float));
        cudaDeviceSynchronize();
        cudaMalloc((void **) &output, ((N/2)+1)*sizeof(cufftComplex));
        cudaDeviceSynchronize();
        cudaMalloc((void **) &output2, ((N/2)+1)*sizeof(cufftComplex));

        cudaDeviceSynchronize();

        cout << "FFT1";
        cufftPlan1d(&plan, N, CUFFT_R2C, 1);
        cout << "FFT2";
        cudaDeviceSynchronize();
        cufftPlan1d(&plan2, N, CUFFT_R2C, 1);


        cufftExecR2C(plan,(cufftReal *) ppf_out1_d,(cufftComplex *) output);
        //synchronize
        cudaDeviceSynchronize();
        cufftExecR2C(plan2,(cufftReal *) ppf_out2_d,(cufftComplex *) output);

        cudaDeviceSynchronize();

        cufftDestroy(plan);
        cufftDestroy(plan2);

}
~

If the plan2 part is deleted the program runs.

I am running the newest driver and compiler.

Any help will be greatly appreciated.

I cannot reproduce your error on a linux machine with cuda 6.0 or 6.5 and driver 340.21 with arch=sm_20 or arch=sm_35. The code runs without error…

Ah. seems like my driver was a little out of date after all. thanks.