Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*

Option '-TC'

GisleVanem
初學者
2,018 檢視

Just installed Intel's oneAPI and it's compiler dpcpp.exe.

Trying it to compile a C-project of mine seems impossible w/o a major rewrite.

Seems to me it only supports C++ even when using "dpcpp -TC ...". Rather disappointing.

 

Many warnings on stuff like "char *p = malloc (len);" causing

error: cannot initialize a variable of type 'char *' with an rvalue of type 'void *'

 

So what's the option "-TC" really for?

 

Edit: Switching to icx.exe did the trick. 

0 積分
7 回應
DitiD_Intel
主席
1,994 檢視

Hi,


Thank you for posting in Intel Communities.


>> So what's the option "-TC" really for?


This option tells the compiler to process all source or unrecognized file types as C source files.


For more information, please refer to the link mentioned below.


https://www.intel.com/content/www/us/en/develop/documentation/oneapi-dpcpp-cpp-compiler-dev-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/miscellaneous-options/tc-1.html


Could you please provide us with a sample reproducer along with the compiler version being used so that we can investigate your issue from our end.


Thanks and Regards,

Ditipriya.


GisleVanem
初學者
1,986 檢視

Could you please provide us with a sample reproducer along with the compiler version being used so that we can investigate your issue from our end.


Here is a simple example GNU-makefile (called dpcpp-test.mak) or attached:

------------- 8< --- 8< -----------

CFLAGS = -MD -TC

all: dpcpp-test.exe

dpcpp-test.exe: dpcpp-test.obj
  xilink -out:dpcpp-test.exe $<

dpcpp-test.obj: dpcpp-test.c
  dpcpp $(CFLAGS) -Fo$@ $<

dpcpp-test.c: dpcpp-test.mak
  $(info Generating $@)
  $(file > $@,$(dpcpp-test_C))

 

define dpcpp-test_C
  //
  // Generated file. DO NOT EDIT!
  //
  #include <stdio.h>
  #include <stdlib.h>
  int main (void)
  {
    char *p = malloc(1000);

    printf ("p: 0x%p\n", p);
    p ? free(p) : ((void)0);
    return (0);
  }
endef

------------- 8< --- 8< -----------

Issuing make -f dpcpp-test.mak, gives:

 

Generating dpcpp-test.c
dpcpp -MD -TC -Fodpcpp-test.obj dpcpp-test.c
dpcpp-test.c(8,11): error: cannot initialize a variable of type 'char *' with an rvalue of type 'void *'
char *p = malloc(1000);
^ ~~~~~~~~~~~~
1 error generated.

 

Enough said.

 

 

DitiD_Intel
主席
1,915 檢視

Hi,


DPC++ will support only c++ code from c++ 17 and onwards. Hence -TC option does not work.

It is working with icx and icx in windows works for both c as well as c++ code. So, it is behaving correctly.


Thanks and Regards,

Ditipriya.


GisleVanem
初學者
1,907 檢視

>  Hence -TC option does not work.

 

A dpcpp -? lists it as an valid option.  Time to clean-up this options mess?

DitiD_Intel
主席
1,891 檢視

Hi,

 

Could you please confirm the OS you're using?

 

For windows, /TC is a valid option, however for linux, -TC is not listed as a valid option.

 

Thanks and Regards,

Ditipriya.

 

 

DitiD_Intel
主席
1,844 檢視

Hi,


We've not heard back from you. Can you please provide an update?


Thanks and Regards,

Ditipriya.



DitiD_Intel
主席
1,835 檢視

Hi,


We have not heard back from you. This thread will no longer be monitored by Intel. If you need further assistance, please post a new question.


Thanks & Regards,

Ditipriya.


回覆