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
Beginner
2,019 Views

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 Kudos
7 Replies
DitiD_Intel
Moderator
1,995 Views

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.


0 Kudos
GisleVanem
Beginner
1,987 Views

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.

 

 

0 Kudos
DitiD_Intel
Moderator
1,916 Views

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.


0 Kudos
GisleVanem
Beginner
1,908 Views

>  Hence -TC option does not work.

 

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

0 Kudos
DitiD_Intel
Moderator
1,892 Views

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.

 

 

0 Kudos
DitiD_Intel
Moderator
1,845 Views

Hi,


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


Thanks and Regards,

Ditipriya.



0 Kudos
DitiD_Intel
Moderator
1,836 Views

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.


0 Kudos
Reply