[Bug jit/87291] Add support for inline asm to libgccjit

2020-06-03 Thread programmerjake at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87291

programmerjake at gmail dot com changed:

   What|Removed |Added

 CC||programmerjake at gmail dot com

--- Comment #10 from programmerjake at gmail dot com ---
(In reply to bouanto from comment #9)
> Does gcc provide a way to specify whether the stack should be aligned
> properly, or is it done automatically, or should it be specified manually in
> asm_template with a string like ".align 32"?

using ".align 32" in the assembly string would align the machine code instead
of the stack, so that's probably not what you want.

>From what I understand, gcc doesn't currently provide a way to align the stack
for inline assembly even in C.

[Bug jit/87291] Add support for inline asm to libgccjit

2020-06-03 Thread programmerjake at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87291

--- Comment #11 from programmerjake at gmail dot com ---
(In reply to programmerjake from comment #10)
> (In reply to bouanto from comment #9)
> > Does gcc provide a way to specify whether the stack should be aligned
> > properly, or is it done automatically, or should it be specified manually in
> > asm_template with a string like ".align 32"?
> 
> using ".align 32" in the assembly string would align the machine code
> instead of the stack, so that's probably not what you want.
> 
> From what I understand, gcc doesn't currently provide a way to align the
> stack for inline assembly even in C.

However, I think it would be a good idea to have a parameter/flag set aside for
supporting aligning the stack for when GCC gains support for that, the flag can
just cause an error for now.

[Bug jit/87291] New: Add support for inline asm to libgccjit

2018-09-12 Thread programmerjake at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87291

Bug ID: 87291
   Summary: Add support for inline asm to libgccjit
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: jit
  Assignee: dmalcolm at gcc dot gnu.org
  Reporter: programmerjake at gmail dot com
  Target Milestone: ---

I'm thinking of using libgccjit for generating code for a custom RISC-V
architecture. Support for using inline asm would be nice so I can use stock gcc
without having to add lots of intrinsics for custom instructions.

If this isn't the right place for feature requests please let me know.

[Bug c++/70447] New: delete operator not called when destructor throws.

2016-03-29 Thread programmerjake at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70447

Bug ID: 70447
   Summary: delete operator not called when destructor throws.
   Product: gcc
   Version: 4.8.4
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: programmerjake at gmail dot com
  Target Milestone: ---

Created attachment 38126
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38126&action=edit
test source

[Bug c++/70447] delete operator not called when destructor throws.

2016-03-29 Thread programmerjake at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70447

programmerjake at gmail dot com changed:

   What|Removed |Added

 CC||programmerjake at gmail dot com

--- Comment #1 from programmerjake at gmail dot com ---
the test case should print:
destructor
operator delete
catch

It works fine on clang.

[Bug c++/71248] New: crash on in-class initializer of array of pointer to member

2016-05-23 Thread programmerjake at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71248

Bug ID: 71248
   Summary: crash on in-class initializer of array of pointer to
member
   Product: gcc
   Version: 4.8.4
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: programmerjake at gmail dot com
  Target Milestone: ---

g++ --version
g++ (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

g++ -std=c++11 code.cpp
code.cpp:6:5: internal compiler error: Segmentation fault
 };
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
Preprocessed source stored into /tmp/ccAlvGe3.out file, please attach this to
your bugreport.


code.cpp:
struct S
{
int a;
static int S::*typeMembers[] = {
&S::a,
};
};

[Bug c++/71248] crash on in-class initializer of array of pointer to member

2016-05-30 Thread programmerjake at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71248

--- Comment #2 from programmerjake at gmail dot com ---
still crashes on 4.8.5:

g++ (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5

[Bug libstdc++/81256] New: basic_filebuf::close doesn't propagate exceptions

2017-06-29 Thread programmerjake at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81256

Bug ID: 81256
   Summary: basic_filebuf::close doesn't propagate exceptions
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: programmerjake at gmail dot com
  Target Milestone: ---

in line 247 of fstream.tcc, basic_filebuf::close ignores exceptions thrown by
_M_terminate_output. _M_terminate_output calls unshift on the codecvt facet
from the imbued locale. unshift might throw if using a custom codecvt facet.

the standard (N4659) says (30.9.2.3.7), referring to calling unshift and other
functions:
If one of these calls throws an exception,
the exception is caught and rethrown after closing the file.

[Bug libstdc++/81256] basic_filebuf::close doesn't propagate exceptions

2017-06-29 Thread programmerjake at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81256

--- Comment #1 from programmerjake at gmail dot com ---
assuming this is fixed, basic_filebuf::~basic_filebuf will need to add a
try-catch to ignore exceptions thrown there instead of calling terminate
because it's noexcept.

[Bug c++/77562] New: large amount of memory usage when allocating big arrays

2016-09-11 Thread programmerjake at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77562

Bug ID: 77562
   Summary: large amount of memory usage when allocating big
arrays
   Product: gcc
   Version: 6.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: programmerjake at gmail dot com
  Target Milestone: ---

when using gcc 5+, compiling the following code uses a huge amount of memory
creating a read-only template object. On gcc 4.9 and before, it does the
expected thing, filling the array in a loop without a source object that it's
copying from.

code:
struct S
{
  long a = 1;
};

template 
struct A
{
  T value[N];
};

void *fn()
{
  return new A, 400>, 400>;
}

[Bug c++/77562] large amount of memory usage when allocating big arrays

2016-09-11 Thread programmerjake at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77562

--- Comment #3 from programmerjake at gmail dot com ---
I would think that unrolling loops would be best left till after
gimplification.

[Bug c++/77562] large amount of memory usage when allocating big arrays

2016-09-11 Thread programmerjake at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77562

--- Comment #6 from programmerjake at gmail dot com ---
(In reply to Andrew Pinski from comment #5)
> Note I suspect this is due to "long a = 1;" being treated as a constexpr
> something like that now.

it is. In the original code I had, S has a constexpr default constructor.

[Bug c++/66360] New: thread_local variable needs copy constructor

2015-06-01 Thread programmerjake at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66360

Bug ID: 66360
   Summary: thread_local variable needs copy constructor
   Product: gcc
   Version: 4.8.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: programmerjake at gmail dot com
  Target Milestone: ---

Created attachment 35663
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35663&action=edit
source code

thread_local variable won't compile when trying to forward empty argument list
to member variable where the member variable has deleted copy/move
constructors.


[Bug c++/61717] New: seg fault on using variadic templates to initialize array

2014-07-04 Thread programmerjake at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61717

Bug ID: 61717
   Summary: seg fault on using variadic templates to initialize
array
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: programmerjake at gmail dot com

Created attachment 33071
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33071&action=edit
preprocessed source

segmentation fault on using variadic templates to initialize array

gcc command line :
g++ -std=c++11 -Wall -fexceptions -g  -c main.cpp -o main.o
gcc output :
In file included from main.cpp:2:0:
garbage_collector.h:321:87: internal compiler error: Segmentation fault
 successive_range, ptrArray)>
GCPtrArray::objectOffsetArray
   
   ^


[Bug c++/61717] seg fault on using variadic templates to initialize array

2014-07-04 Thread programmerjake at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61717

--- Comment #1 from programmerjake at gmail dot com ---
gcc version string:
gcc (Debian 4.9.0-6) 4.9.0


[Bug c++/68574] New: add -W#pragma-messages equivalent

2015-11-26 Thread programmerjake at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68574

Bug ID: 68574
   Summary: add -W#pragma-messages equivalent
   Product: gcc
   Version: 5.2.0
Status: UNCONFIRMED
  Severity: enhancement
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: programmerjake at gmail dot com
  Target Milestone: ---

There is no -Wno-error=... option to prevent conversion of warnings from
#pragma GCC warning "..."
to error messages when using -Werror

Test Case:
Source:
#pragma GCC warning "my warning"
Command Line:
g++ -v -fdiagnostics-show-option -Werror test.cpp

Using built-in specs.
COLLECT_GCC=/opt/gcc-5.2.0/bin/g++
Target: x86_64-linux-gnu
Configured with: ../gcc-5.2.0/configure --prefix
/data/teamcity/work/sud-chibld05-002-RHEL6/cd26a0c570c605bd/scratch/gcc/5.2.0/staging
--build=x86_64-linux-gnu --disable-multilibs --enable-clocale=gnu
--enable-languages=c,c++ --enable-ld=yes --enable-gold=yes
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-linker-build-id
--enable-lto --enable-plugins --enable-threads=posix --host=x86_64-linux-gnu
--target=x86_64-linux-gnu --with-pkgversion=GCC-explorer-build
--with-system-zlib --disable-werror
--with-libelf=/data/teamcity/work/sud-chibld05-002-RHEL6/cd26a0c570c605bd/scratch/gcc/5.2.0/build/libelf-0.8.13
Thread model: posix
gcc version 5.2.0 (GCC-explorer-build)
COLLECT_GCC_OPTIONS='-v' '-fdiagnostics-show-option' '-Werror' '-masm=intel'
'-g' '-o' '/tmp/gcc-explorer-compiler1151027-68-1cy2m3d/output.S' '-S'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
/opt/gcc-5.2.0/bin/../libexec/gcc/x86_64-linux-gnu/5.2.0/cc1plus -quiet -v
-iprefix /opt/gcc-5.2.0/bin/../lib/gcc/x86_64-linux-gnu/5.2.0/ -D_GNU_SOURCE
/tmp/gcc-explorer-compiler1151027-68-1cy2m3d/example.cpp -quiet -dumpbase
example.cpp -masm=intel -mtune=generic -march=x86-64 -auxbase-strip
/tmp/gcc-explorer-compiler1151027-68-1cy2m3d/output.S -g -Werror -version
-fdiagnostics-show-option -o
/tmp/gcc-explorer-compiler1151027-68-1cy2m3d/output.S
GNU C++ (GCC-explorer-build) version 5.2.0 (x86_64-linux-gnu)
compiled by GNU C version 5.2.0, GMP version 4.3.2, MPFR version 2.4.2, MPC
version 0.8.1
GGC heuristics: --param ggc-min-expand=63 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"/opt/gcc-5.2.0/bin/../lib/gcc/x86_64-linux-gnu/5.2.0/../../../../x86_64-linux-gnu/include"
ignoring duplicate directory
"/opt/gcc-5.2.0/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/5.2.0/../../../../include/c++/5.2.0"
ignoring duplicate directory
"/opt/gcc-5.2.0/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/5.2.0/../../../../include/c++/5.2.0/x86_64-linux-gnu"
ignoring duplicate directory
"/opt/gcc-5.2.0/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/5.2.0/../../../../include/c++/5.2.0/backward"
ignoring duplicate directory
"/opt/gcc-5.2.0/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/5.2.0/include"
ignoring duplicate directory
"/opt/gcc-5.2.0/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/5.2.0/include-fixed"
ignoring nonexistent directory
"/opt/gcc-5.2.0/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/5.2.0/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/opt/gcc-5.2.0/bin/../lib/gcc/x86_64-linux-gnu/5.2.0/../../../../include/c++/5.2.0
/opt/gcc-5.2.0/bin/../lib/gcc/x86_64-linux-gnu/5.2.0/../../../../include/c++/5.2.0/x86_64-linux-gnu
/opt/gcc-5.2.0/bin/../lib/gcc/x86_64-linux-gnu/5.2.0/../../../../include/c++/5.2.0/backward
/opt/gcc-5.2.0/bin/../lib/gcc/x86_64-linux-gnu/5.2.0/include
/opt/gcc-5.2.0/bin/../lib/gcc/x86_64-linux-gnu/5.2.0/include-fixed
/usr/local/include
/opt/gcc-5.2.0/bin/../lib/gcc/../../include
/usr/include
End of search list.
GNU C++ (GCC-explorer-build) version 5.2.0 (x86_64-linux-gnu)
compiled by GNU C version 5.2.0, GMP version 4.3.2, MPFR version 2.4.2, MPC
version 0.8.1
GGC heuristics: --param ggc-min-expand=63 --param ggc-min-heapsize=131072
Compiler executable checksum: 1179f1e221bf82c10f9efb16cae24728
1 : error: my warning [-Werror]
#pragma GCC warning "my warning"
^
cc1plus: all warnings being treated as errors
Compilation failed

[Bug c++/68574] add -W#pragma-messages equivalent

2015-11-26 Thread programmerjake at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68574

programmerjake at gmail dot com changed:

   What|Removed |Added

 CC||programmerjake at gmail dot com

--- Comment #1 from programmerjake at gmail dot com ---
I suggest either adding clang's option -W#pragma-messages or adding
-Wpragma-messages.

[Bug c++/71587] New: missed inlining extern template function

2016-06-19 Thread programmerjake at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71587

Bug ID: 71587
   Summary: missed inlining extern template function
   Product: gcc
   Version: 5.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: programmerjake at gmail dot com
  Target Milestone: ---

missed inlining fn2

version: (Ubuntu 5.3.0-3ubuntu1~14.04) 5.3.0 20151204

command: g++-5 -O3 -S -std=c++11 -xc++ -
source:
template 
void fn2();

extern template void fn2();

void fn3();

void fn()
{
  fn2();
  fn3();
}

template 
void fn2()
{
}

template void fn2();

It generates
subq$8, %rsp
callvoid fn2()
addq$8, %rsp
jmp fn3()
It should generate
jmp fn3()

[Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword

2021-04-22 Thread programmerjake at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847

--- Comment #12 from programmerjake at gmail dot com ---
(In reply to Jakub Jelinek from comment #11)
> Fixed.

Thanks!!

[Bug c++/98846] New: Spurious -Wregister warning

2021-01-26 Thread programmerjake at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98846

Bug ID: 98846
   Summary: Spurious -Wregister warning
   Product: gcc
   Version: 10.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: programmerjake at gmail dot com
  Target Milestone: ---

In:
https://gcc.godbolt.org/z/49xoKP

With the following code:

template 
int template_get_edx() {
register int edx asm("edx");
asm("movl $1234, %%edx\n\t# reg=%0" : "=r"(edx));
return edx;
}

template int template_get_edx();

With: -O -Wall -std=c++17

produces:
: In instantiation of 'int template_get_edx() [with T = void]':
:8:37:   required from here
:3:18: warning: ISO C++17 does not allow 'register' storage class
specifier [-Wregister]
3 | register int edx asm("edx");

I think that warning is spurious because the `register` keyword is required for
clang to not ignore the asm("edx").

[Bug inline-asm/98847] New: Miscompilation with c++17, templates, and register keyword

2021-01-26 Thread programmerjake at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847

Bug ID: 98847
   Summary: Miscompilation with c++17, templates, and register
keyword
   Product: gcc
   Version: 10.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: inline-asm
  Assignee: unassigned at gcc dot gnu.org
  Reporter: programmerjake at gmail dot com
  Target Milestone: ---
  Host: x86_64-linux-gnu
Target: x86_64-linux-gnu

In:
https://gcc.godbolt.org/z/49xoKP

With the following code:

template 
int template_get_edx() {
register int edx asm("edx");
asm("movl $1234, %%edx\n\t# reg=%0" : "=r"(edx));
return edx;
}

template int template_get_edx();

With: -O -Wall -std=c++17

Miscompiles, allocating %eax to the C++-level edx variable.

It's possible the C++ frontend is removing the register keyword before
finishing parsing since it also incorrectly warns here (bug #98846)

produces:
_Z16template_get_edxIvEiv:
.LFB1:
.file 1 "./example.cpp"
.loc 1 2 5 view -0
.cfi_startproc
.loc 1 4 5 is_stmt 0 view .LVU1
#APP
# 4 "./example.cpp" 1
movl $1234, %edx
# reg=%eax
# 0 "" 2
.LVL0:
.loc 1 6 1 view .LVU2
#NO_APP
ret

[Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword

2021-01-27 Thread programmerjake at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847

--- Comment #4 from programmerjake at gmail dot com ---
(In reply to Jakub Jelinek from comment #3)
> Created attachment 50066 [details]
> gcc11-pr98847.patch
> 
> Untested fix.

That will probably also fix bug #98846

[Bug inline-asm/98847] Miscompilation with c++17, templates, and register keyword

2021-02-01 Thread programmerjake at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98847

--- Comment #8 from programmerjake at gmail dot com ---
Can the fix for this be backported to gcc 8 and 9 too? Thanks!