[Bug c++/81429] New: maybe_unused attribute triggers syntax error when used on first argument to a constructor

2017-07-13 Thread jeff.benshetler at stackpath dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81429

Bug ID: 81429
   Summary: maybe_unused attribute triggers syntax error when used
on first argument to a constructor
   Product: gcc
   Version: 7.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jeff.benshetler at stackpath dot com
  Target Milestone: ---

Created attachment 41746
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41746&action=edit
Preprocessed file that triggers the bug.

maybe_unused attribute triggers syntax error when used on first argument to a
constructor

Systm Type: Linux bnx1-lab1-dfw0.stackpath.systems 3.10.0-514.10.2.el7.x86_64
#1 SMP Fri Mar 3 00:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Options given when GCC was configured/built: 
  tar xzf gcc-7.1.0.tar.gz
  cd gcc-7.1.0
  ./contrib/download_prerequisites
  cd ..
  mkdir objdir-7.1.0
  cd objdir-7.1.0
  ../gcc-7.1.0/configure --prefix=/opt/gcc-7.1.0 --enable-languages=c,c++
--disable-multilib
  make -j60
  sudo make install

Complete command line that triggers the bug: g++ -Wall -Wextra -save-temps -c
maybe_unused.cpp

Compiler Output
  maybe_unused.cpp:3:9: error: expected unqualified-id before ‘[’ token
 Foo([[maybe_unused]] int x) // fails
 ^
  maybe_unused.cpp:3:9: error: expected ‘)’ before ‘[’ token
This bug occurs with gcc-6.3.0, gcc-6.4.0, gcc-7.1.0. clang-3.9 is fine with
the code.

[Bug c++/81429] maybe_unused attribute triggers syntax error when used on first argument to a constructor

2017-07-13 Thread jeff.benshetler at stackpath dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81429

--- Comment #1 from Jeff Benshetler  ---
Created attachment 41747
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41747&action=edit
Source test case that triggers the bug; corresponds to .ii file

Added in an abundance of caution. 
No header files are used. 
The first constructor has [[maybe_used]] on the first constructor parameter and
it triggers the bug.
The second constructor uses [[maybe_unused]] on the second constructor
parameter and it is fine.

[Bug c++/82496] New: Optimization breaks duration_cast

2017-10-09 Thread jeff.benshetler at stackpath dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82496

Bug ID: 82496
   Summary: Optimization breaks duration_cast
   Product: gcc
   Version: 6.4.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jeff.benshetler at stackpath dot com
  Target Milestone: ---

Created attachment 42331
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42331&action=edit
Compiler output

duration_cast always returns zero when using any level of optimization.
duration_cast works properly when compiled without optimization

GCC Version: g++ (GCC) 6.3.0

System Type: Darwin Jeffs-MacBook-Pro.local 16.7.0 Darwin Kernel Version
16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64
x86_64

Options when GCC was configured/built:
/Users/jbenshetler/build/gcc/objdir/../gcc-6.3.0/configure
--prefix=/opt/gcc-6.3.0 --enable-languages=c,c++,fortran --disable-multilib

Exact command line passed to gcc triggering the bug: g++ -O1 -o
duration_cast_error -v -save-temps duration_cast_error.cpp 2>
duration_cast_error.log

[Bug c++/82496] Optimization breaks duration_cast

2017-10-09 Thread jeff.benshetler at stackpath dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82496

Jeff Benshetler  changed:

   What|Removed |Added

 CC||jeff.benshetler at stackpath 
dot c
   ||om

--- Comment #1 from Jeff Benshetler  ---
Created attachment 42332
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42332&action=edit
Preprocessed file that triggers the bug.

When compiled without optimization and run, running the executable produces the
following correct output:
  deltaT=2.00275

When compiled with any level of optimization (-O1 or greater), running the
executable produces the following erroneous output:
  deltaT=0

[Bug c++/82496] Optimization breaks duration_cast

2017-10-09 Thread jeff.benshetler at stackpath dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82496

--- Comment #2 from Jeff Benshetler  ---
I confirmed that the identical problem exists on Linux for both gcc-6.4.0 and
gcc-7.2.0.

[Bug libstdc++/82496] Optimization breaks duration_cast

2017-10-09 Thread jeff.benshetler at stackpath dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82496

--- Comment #4 from Jeff Benshetler  ---
My apologies. Adding -Wall shows:
warning: no return statement in function returning non-void [-Wreturn-type]