x86_32: gnu++11 vs c++11

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I am in the middle of a creduce step. Please consider the attached c++
code (math_test.cc).

Here is what I am seeing on my Debian/sid/amd64 system:

 % g++ -std=c++11 -g -m32 -O2 -o works math_test.cc -Wfatal-errors
-Wall -Wextra -Werror -Wpedantic && ./works && echo "success"
success

However now:

 % g++ -std=gnu++11 -g -m32 -O2 -o fails math_test.cc -Wfatal-errors
-Wall -Wextra -Werror -Wpedantic && ./fails
zsh: IOT instruction  ./fails

I fail to understand what are the differences between gnu++11 and
c++11 (maybe I missed some obvious documentation?). On my system I
assumed the only differences would be those (*).

How can I inspect the differences between gnu++11 and c++11 on my
system on this piece of code ?

Thanks for suggestions

-M

(*)
% g++ -std=gnu++11 -g -m32 -O2 -o fails.i math_test.cc -Wfatal-errors
-Wall -Wextra -Werror -Wpedantic -E
% g++ -std=c++11 -g -m32 -O2 -o works.i math_test.cc -Wfatal-errors
-Wall -Wextra -Werror -Wpedantic -E
 % diff -u works.i fails.i
--- works.i     2023-09-06 12:49:15.134610410 +0000
+++ fails.i     2023-09-06 12:49:06.602550148 +0000
@@ -5739,7 +5739,22 @@
   inline constexpr long double
   abs(long double __x)
   { return __builtin_fabsl(__x); }
-# 150 "/usr/include/c++/13/bits/std_abs.h" 3
+# 135 "/usr/include/c++/13/bits/std_abs.h" 3
+  __extension__ inline constexpr
+  __float128
+  abs(__float128 __x)
+  {
+
+
+
+    return __builtin_fabsf128(__x);
+
+
+
+
+  }
+
+

 }
 }

-- 
Mathieu
#include <assert.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#define ae(a, b) a < b ? 0 : b
template <size_t ai, typename aj, typename an> void ao(aj c, an p2) {
  __builtin_memcpy(p2, c, ai);
}
template <typename aj, typename an> void az(aj *c, an p2) {
  ao<sizeof(aj)>(c, p2);
}
template <typename ba> struct e { using bb = ba; };
template <typename bf> struct bh { bf bi[sizeof(bf)]; };
struct g {
  static int m_fn1(bool c) { return c ? ~int{} : 0; }
  int bits[sizeof(int)];
};
template <class bj> bh<typename bj::bb> bk(bj) {
  bh<typename bj::bb> i{};
  return i;
}
template <class bj> using bn = decltype(bk(bj()));
template <class bj, class bo> bn<bj> br(bj, bo p2) {
  bn<bj> bq;
  az(&p2, &bq);
  return bq;
}
bh<float> bs(float c) {
  bh<float> i;
  i.bi[0] = c;
  return i;
}
bh<float> bw(bh<float> c, bh<float> p2) {
  e<float> d;
  e<uint32_t> bv;
  auto au = br(bv, c), bu = br(bv, p2);
  au.bi[0] &= bu.bi[0];
  return br(d, au);
}
bh<float> by(bh<float> c, bh<float> p2) {
  e<float> d;
  e<uint32_t> bv;
  auto au = br(bv, c), bu = br(bv, p2);
  au.bi[0] |= bu.bi[0];
  return br(d, au);
}
bh<float> bx(bh<float> c, bh<float> p2, bh<float> k) {
  bh<float> ca = bw(c, p2);
  return by(ca, k);
}
bh<float> bz(g c) {
  bh<float> i;
  az(&c, &i);
  return i;
}
bh<float> cc(g c, bh<float> p2, bh<float> k) {
  bh<float> cb = bz(c);
  return bx(cb, p2, k);
}
bh<float> cf(bh<float> c) {
  e<float> d;
  bh<float> o = bk(d);
  return bx(c, o, c);
}
bh<float> cd(bh<float> c, bh<float> p2) {
  c.bi[0] += p2.bi[0];
  return c;
}
bh<float> ce(bh<float> c, bh<float> p2) {
  c.bi[0] -= p2.bi[0];
  return c;
}
bh<float> operator-(bh<float> c, bh<float> p2) { return ce(c, p2); }
bh<float> operator+(bh<float> c, bh<float> p2) { return cd(c, p2); }
bh<float> cg(bh<float> c, bh<float> p2) {
  c.bi[0] = p2.bi[0];
  return c;
}
bh<float> operator*(bh<float> c, bh<float> p2) { return cg(c, p2); }
g operator==(bh<float> c, bh<float> p2) {
  g m;
  m.bits[0] = g::m_fn1(c.bi[0] == p2.bi[0]);
  return m;
}
bh<float> bl(bh<float> c, bh<float> p2) { return c + p2; }
bh<float> bm(bh<float> c, bh<float> p2) { return c - p2; }
bh<float> bg(bh<float> c, bh<float> p2) { return c * p2; }
g bp(bh<float> c, bh<float> p2) { return c == p2; }
bh<float> ad(e<float>, bh<float> p2) {
  bh<float> ay = bs(float(1.0)), u = bl(p2, ay), at;
#ifdef DOPRINT
  printf("au0: %g %g \n", u.bi[0], ay.bi[0]);
#endif
  auto au = bp(u, ay);
  bh<float> ch = cf(u);
  auto av = bm(ch, ay);
  auto ax = bg(at, av);
  return cc(au, p2, ax);
}
template <class a, class b> a al(b c) {
  a f;
  ao<sizeof(f)>(&c, &f);
  return f;
}
void am(bh<float> c(e<float>, bh<float>)) {
  int af = 0, ah = 0;
  e<float> p2;
  uint32_t as = 528484000;
  float q = al<float>(as), ab(q);
  bh<float> r = bs(q), ci = c(p2, r);
  float ak = ci.bi[0];
  az(&ak, &af);
  az(&ab, &ah);
  int aw = ah - ae(af, ah);
  uint64_t p = aw;
  if (!(p <= 2))
    abort();
}
int main() { am(ad); }

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux