https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69216
Bug ID: 69216 Summary: posix_memalign Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: snino64 at yahoo dot es Target Milestone: --- SugarR: https://github.com/Zerbinati/SugarR The file opt.cpp /* SugaR, a UCI chess playing engine derived from Stockfish Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad SugaR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SugaR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <stdio.h> // Benigno #include <iostream> // #include "thread.h" #include "tt.h" using namespace std; #define TRUE 1 #define FALSE 0 int large_use; int MemError; #ifndef _WIN32 // Linux #include <sys/ipc.h> #include <sys/shm.h> // Benigno #define MEMALIGN(a, b, c) posix_memalign ((void**) &(a), b, c) #define ALIGNED_FREE(x) free (x); static int num; void SETUP_PRIVILEGES(){} void CREATE_MEM(void** A,int align,uint64_t size) { large_use=FALSE; num=shmget(IPC_PRIVATE,size,IPC_CREAT|SHM_R|SHM_W|SHM_HUGETLB); if(num==-1) { printf("info string LargePages FAILED %llu Mb\n",(unsigned long long int) size>>20); MemError = MEMALIGN((*A),align,size); } else { (*A)=shmat(num,NULL,0x0); large_use=TRUE; printf("info string LargePages OK %llu Mb\n",(unsigned long long int) size>>20); std::cout<<"info string HUGELTB "<<(size>>20)<<std::endl; } } void CREATE_MEM2(void** A,uint64_t size) { large_use=FALSE; num=shmget(IPC_PRIVATE,size,IPC_CREAT|SHM_R|SHM_W|SHM_HUGETLB); if(num!=-1) { (*A)=shmat(num,NULL,0x0); large_use=TRUE; printf("info string %llu Mb LargePages\n",(unsigned long long int) size>>20); } } void FREE_MEM(void* A) { if(!A) return; if(!large_use) { ALIGNED_FREE(A); return; } shmdt(A); shmctl(num,IPC_RMID,NULL); large_use=FALSE; } #else #define MEMALIGN(a, b, c) a = _aligned_malloc (c, b) #define ALIGNED_FREE(x) _aligned_free (x) // void CREATE_MEM(void** A,int align,uint64_t size) { large_use=FALSE; (*A)=VirtualAlloc(NULL,size,MEM_LARGE_PAGES|MEM_COMMIT|MEM_RESERVE,PAGE_READWRITE); if((*A)) { large_use=TRUE; printf("info string %llu Mb LargePages\n",(unsigned long long int) size>>20); } else { printf("info string %llu Mb(no LargePages)\n",(unsigned long long int) size>>20); MEMALIGN((*A),align,size); } } void CREATE_MEM2(void** A,uint64_t size) { large_use=FALSE; (*A)=VirtualAlloc(NULL,size,MEM_LARGE_PAGES|MEM_COMMIT|MEM_RESERVE,PAGE_READWRITE); if((*A)) { large_use=TRUE; printf("info string LargePages %llu Mb\n",(unsigned long long int) size>>20); } } void FREE_MEM(void* A) { if(!A) return; if(!large_use) ALIGNED_FREE(A); else { VirtualFree(A,0,MEM_RELEASE); large_use=FALSE; } } void SETUP_PRIVILEGES() { HANDLE TH,PROC; TOKEN_PRIVILEGES tp; PROC=GetCurrentProcess(); OpenProcessToken(PROC,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY,&TH); LookupPrivilegeValue(NULL,TEXT("SeLockMemoryPrivilege"),&tp.Privileges[0].Luid); tp.PrivilegeCount=1; tp.Privileges[0].Attributes=SE_PRIVILEGE_ENABLED; AdjustTokenPrivileges(TH,FALSE,&tp,0,NULL,0); CloseHandle(TH); } #endif I do: make profile-build ARCH=x86-64-modern g++ -o SugaR benchmark.o bitbase.o bitboard.o book.o endgame.o evaluate.o main.o material.o misc.o movegen.o movepick.o opt.o pawns.o position.o psqt.o search.o thread.o timeman.o tt.o uci.o ucioption.o syzygy/tbprobe.o -lgcov -Wl,--no-as-needed -lpthread -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11 -fprofile-use -fno-peel-loops -fno-tracer -pedantic -Wextra -Wshadow -DNDEBUG -O3 -DIS_64BIT -msse -DUSE_BSFQ -msse3 -mpopcnt -DUSE_POPCNT -flto lto1: internal compiler error: Violación de segmento 0x940bef crash_signal ../../src/gcc/toplev.c:383 0x7e54a0 ipa_merge_profiles(cgraph_node*, cgraph_node*, bool) ../../src/gcc/ipa-utils.c:571 0x5f5074 lto_cgraph_replace_node ../../src/gcc/lto/lto-symtab.c:126 0x5f5cd4 lto_symtab_merge_symbols() ../../src/gcc/lto/lto-symtab.c:712 0x5edcb8 read_cgraph_and_symbols ../../src/gcc/lto/lto.c:3136 0x5edcb8 lto_main() ../../src/gcc/lto/lto.c:3475 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions. lto-wrapper: fatal error: g++ returned 1 exit status compilation terminated. /usr/bin/ld: lto-wrapper failed collect2: error: ld returned 1 exit status Makefile:481: recipe for target 'SugaR' failed make[2]: *** [SugaR] Error 1 make[2]: Leaving directory '/home/benigno/Ajedrez/Motores/Sugar/Pro 2.0/SugaR-master/srcPrO' Makefile:493: recipe for target 'gcc-profile-use' failed make[1]: *** [gcc-profile-use] Error 2 make[1]: Leaving directory '/home/benigno/Ajedrez/Motores/Sugar/Pro 2.0/SugaR-master/srcPrO' Makefile:409: recipe for target 'profile-build' failed make: *** [profile-build] Error 2