← Back to team overview

leaningtech-dev team mailing list archive

[Bug 1302695] [NEW] range based for produces JS syntax error with -O2

 

Public bug reported:

As per summary.

I don't know the exact cause of this bug, It seems to happen only with -O2 (atl east not with -O0)
Testcase attached.

This is the relevant LLVM code output:

%struct._ZSt5arrayIiLj2EE = type { [2 x i32] }

@arr = global %struct._ZSt5arrayIiLj2EE { [2 x i32] [i32 1, i32 2] },
align 1

; Function Attrs: nounwind
define i32 @main() #0 {
  br i1 icmp eq (i32* getelementptr inbounds (%struct._ZSt5arrayIiLj2EE* @arr, i32 0, i32 0, i32 0), i32* getelementptr (%struct._ZSt5arrayIiLj2EE* @arr, i32 0, i32 0, i32 2)), label %._crit_edge, label %.lr.ph
;...

The branch gets translated to

if () {

which is a JS syntax error.

** Affects: duetto
     Importance: Undecided
         Status: New

** Attachment added: "main.cpp"
   https://bugs.launchpad.net/bugs/1302695/+attachment/4065905/+files/main.cpp

-- 
You received this bug notification because you are a member of
Leaningtech Team, which is subscribed to Duetto.
https://bugs.launchpad.net/bugs/1302695

Title:
  range based for produces JS syntax error with -O2

Status in Duetto: C++ for the Web:
  New

Bug description:
  As per summary.

  I don't know the exact cause of this bug, It seems to happen only with -O2 (atl east not with -O0)
  Testcase attached.

  This is the relevant LLVM code output:

  %struct._ZSt5arrayIiLj2EE = type { [2 x i32] }

  @arr = global %struct._ZSt5arrayIiLj2EE { [2 x i32] [i32 1, i32 2] },
  align 1

  ; Function Attrs: nounwind
  define i32 @main() #0 {
    br i1 icmp eq (i32* getelementptr inbounds (%struct._ZSt5arrayIiLj2EE* @arr, i32 0, i32 0, i32 0), i32* getelementptr (%struct._ZSt5arrayIiLj2EE* @arr, i32 0, i32 0, i32 2)), label %._crit_edge, label %.lr.ph
  ;...

  The branch gets translated to

  if () {

  which is a JS syntax error.

To manage notifications about this bug go to:
https://bugs.launchpad.net/duetto/+bug/1302695/+subscriptions


Follow ups

References