GCC 7.2 build bugs on Windows 8.1 and Windows 10

Liu Hao lh_mouse@126.com
Wed Oct 25 01:51:00 GMT 2017


On 2017/10/24 23:55, Jonathan Wakely wrote:
> On 23 October 2017 at 15:55, David Gressett wrote:
>> gcc needs some substantial patching to to build on Windows.
>> The details depend on whether you are building a 64-bit or a 32-bit gcc.
>>
>> There are two projects on Sourceforge which deal with gcc  on Windows:
>>
>> MinGW  (32-bit) and MinGW-w64 (64-bit)
>>
>> The mailing lists for those projects are the best places to go to for information about
>>   building on Windows for a Windows target.
> 
> Did you ever get to the bottom of the problem in
> https://gcc.gnu.org/ml/gcc-help/2017-04/msg00133.html ?
> 
> I see _aligned_malloc in MinGW's <malloc.h> so if the configure script
> found it then I don't understand how it can be missing later.
> 
> If that code still doesn't build we need a bug report.
> 

The attached program would not compile if the first line were 
uncommented, which looks like a bug to me.

```
// #include <intrin.h>
#include <malloc.h>
#include <stdio.h>

int main(void){
	void *ptr;

	ptr = _aligned_malloc(1000, 32);
	printf("ptr = %p\n", ptr);
	_aligned_free(ptr);
}
```

```
E:\Desktop>gcc -Wall -Wextra -pedantic -pedantic-errors -std=c99 test.c
test.c: In function 'main':
test.c:8:8: error: implicit declaration of function '_aligned_malloc'; 
did you mean '_aligned_realloc'? [-Wimplicit-function-declaration]
   ptr = _aligned_malloc(1000, 32);
         ^~~~~~~~~~~~~~~
         _aligned_realloc
test.c:8:6: error: assignment makes pointer from integer without a cast 
[-Wint-conversion]
   ptr = _aligned_malloc(1000, 32);
       ^
test.c:10:2: error: implicit declaration of function '_aligned_free'; 
did you mean '_aligned_realloc'? [-Wimplicit-function-declaration]
   _aligned_free(ptr);
   ^~~~~~~~~~~~~
   _aligned_realloc

E:\Desktop>pacman -Qs -- -headers-git
local/mingw-w64-i686-headers-git 5.0.0.4971.4f97ba8e-1 
(mingw-w64-i686-toolchain)
     MinGW-w64 headers for Windows
local/mingw-w64-x86_64-headers-git 5.0.0.4971.4f97ba8e-1 
(mingw-w64-x86_64-toolchain)
     MinGW-w64 headers for Windows

```


-- 
Best regards,
LH_Mouse



More information about the Gcc-help mailing list