AnyDSL/impala

escape sequences in string literals passed to extern functions break CUDA code generation

michael-kenzel opened this issue · 2 comments

example: we add

extern "device" {
	fn "printf" cuda_device_print_i32(&[u8], i32) -> i32;
}

and call

cuda_device_print_i32("blub %d\n", 42);

the generated CUDA C++ code will end up looking like

        printf_99098 = printf("blub %d
", 42);

resulting in compilation failure.

The problem would seem to be that CUDA C++ code generation does not escape string contents before outputting string literals. "pre-escaping" the string in the original impala source code would seem to be a temporary workaround:

cuda_device_print_i32("blub %d\\n", 42);

@richardmembarth can you have a look at this?