[Bug 1808626] Re: Triple buffer flickering and weird display updating

2018-12-27 Thread P Touchman
And another video of just dragging the display settings window around:

https://www.youtube.com/watch?v=8Eo9hzA51X4

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1808626

Title:
  Triple buffer flickering and weird display updating

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1808626/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1808626] Re: Triple buffer flickering and weird display updating

2018-12-27 Thread P Touchman
Been fiddling with rotating and unrotating displays and when it starts
drawing improperly when rotated, I can unrotate the displays and the
improper drawing/flickering disappears.

Also the improper drawing disappears when I go to mirror mode.

I would imagine most people don't see this bug because few people have
one monitor rotated left and have a second monitor in normal
orientation.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1808626

Title:
  Triple buffer flickering and weird display updating

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1808626/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1808626] Re: Triple buffer flickering and weird display updating

2018-12-27 Thread P Touchman
I've been hesitant to try to reproduce this because my system runs so
well for a long time when this doesn't crop up.

So I rebooted without the video=VGA-1:e parameter and it starts doing
this sort of thing immediately.


I uploaded a video at youtube:

https://www.youtube.com/watch?v=2JOy_ilLAlw


Strangely, when I add the video=VGA-1:e parameter it comes up fine and I tried 
to rotate and unrotate my monitors and various manipulations with ubuntu's 
display settings and xrandr and I couldn't get it to do the flickering thing.

And I think I misspoke, it doesn't seem like triple buffering flicker
but perhaps double buffering flicker.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1808626

Title:
  Triple buffer flickering and weird display updating

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1808626/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1808626] Re: Triple buffer flickering and weird display updating

2018-12-24 Thread P Touchman
I've been running the same setup and it runs absolutely perfectly if I
boot up with editing the Ubuntu command line in grub and add
video=VGA-1:e

BOOT_IMAGE=/boot/vmlinuz-4.15.0-43-generic root=UUID= ro
drm_kms_helper.edid_firmware=VGA-1:edid/hannsg.bin video=VGA-1:e

adding the video=VGA-1:e will allow the drm_kms_helper.edid_firmware
parameter to work and I get my proper display.

If I don't add the video=VGA-1:e line it will come up at 1024x768 mode
and give a "Could not apply the stored configuration for monitors".
After I do this following xrandr command and the stored configuration is
restored I get the flickering problem virtually INSTANTLY.


$ xrandr --newmode "1920x1080R" 138.50 1920 1968 2000 2080 1080 1083 1088  
+hsync -vsync; xrandr --addmode VGA-1 "1920x1080R" 

With the video=VGA-1:e the stored configuration comes up properly on
initial boot and the video drivers work perfectly, no flickering.

https://ptouchman.blogspot.com/2018/12/my-edid-was-going-unrecognized-
until-i.html

I'll post a video when I dig out my digital camera.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1808626

Title:
  Triple buffer flickering and weird display updating

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1808626/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1808626] [NEW] Triple buffer flickering and weird display updating

2018-12-15 Thread P Touchman
Public bug reported:

I've got a dual display setup, with one monitor rotated and I've been
running into some weird bugs.  The screen will not update properly at
times and there will be areas that will intermittently flicker and show
old areas that should have been overdrawn.

Once it starts doing this, the only way to get things back to normal is
to reboot.

Going into standby and coming out of standby won't fix it.  Actually,
sometimes coming out of standby the screen won't refresh properly and
I'll see the whole screen get some triple-buffer epilepsy inducing
flicker.


When I move the mouse from screen to screen and hover over the ubuntu launcher 
dock so that it scrolls the icons it will flip the triple buffers and the areas 
that have old data flickers.

I think the display is triple buffered and one of the buffers gets old
data.  I can refresh the screen by dragging windows around manually like
an "eraser" where I'm using the window to "erase old data" but this
tends to get super annoying.


It seems to get brought out by rotating one of my displays.  I have a
1920x1200 pivoting display that is rotated to the left.  My other
display is 1920x1080 normal at position +1200+364.


I seem to hit this a lot because my monitor doesn't have a good EDID so it 
comes up in ubuntu with an error message about crtcs (since it wants to do a 
1920x1080 and it thinks the max is 1024x768) so after I set a new mode with:

$ xrandr --newmode "1920x1080R"  138.50  1920 1968 2000 2080  1080 1083
1088  +hsync -vsync; xrandr --addmode VGA-1 "1920x1080R"


Once the new mode gets added Ubuntu will automatically restore my desktop to 
its old settings pre-reboot and I start getting the flicker/update problems.


I would imagine that the bug should show itself up if you do a few 
rotate/unrotate displays.


$ lsb_release -rd
Description:Ubuntu 18.04.1 LTS
Release:18.04


$ apt-cache policy xserver-xorg-video-intel
xserver-xorg-video-intel:
  Installed: 2:2.99.917+git20171229-1
  Candidate: 2:2.99.917+git20171229-1
  Version table:
 *** 2:2.99.917+git20171229-1 500
500 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
100 /var/lib/dpkg/status

$ xrandr
Screen 0: minimum 320 x 200, current 3120 x 1920, maximum 8192 x 8192
VGA-1 connected primary 1920x1080+1200+364 (normal left inverted right x axis y 
axis) 0mm x 0mm
   1024x768  60.00  
   800x600   60.3256.25  
   848x480   60.00  
   640x480   59.94  
   1920x1080R59.93* 
HDMI-1 connected 1200x1920+0+0 left (normal left inverted right x axis y axis) 
519mm x 324mm
   1920x1200 59.95*+
   1600x1200 60.00  
   1680x1050 59.88  
   1600x1000 60.01  
   1280x1024 85.0275.0260.02  
   1280x960  60.00  
   1152x864  75.00  
   1152x720  59.97  
   1024x768  75.0360.00  
   832x624   74.55  
   800x600   75.0060.32  
   640x480   75.0059.94  
   720x400   70.08  
DP-1 disconnected (normal left inverted right x axis y axis)

** Affects: xserver-xorg-video-intel (Ubuntu)
 Importance: Undecided
 Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1808626

Title:
  Triple buffer flickering and weird display updating

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1808626/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1808626] Re: Triple buffer flickering and weird display updating

2018-12-15 Thread P Touchman
Here's a listing of my hardware:

$ lscpu
Architecture:x86_64
CPU op-mode(s):  32-bit, 64-bit
Byte Order:  Little Endian
CPU(s):  4
On-line CPU(s) list: 0-3
Thread(s) per core:  2
Core(s) per socket:  2
Socket(s):   1
NUMA node(s):1
Vendor ID:   GenuineIntel
CPU family:  6
Model:   58
Model name:  Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz
Stepping:9
CPU MHz: 1596.441
CPU max MHz: 3300.
CPU min MHz: 1600.
BogoMIPS:6585.26
Virtualization:  VT-x
L1d cache:   32K
L1i cache:   32K
L2 cache:256K
L3 cache:3072K
NUMA node0 CPU(s):   0-3
Flags:   fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca 
cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx 
rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology 
nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 
ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt tsc_deadline_timer xsave avx 
f16c lahf_lm cpuid_fault epb pti ssbd ibrs ibpb stibp tpr_shadow vnmi 
flexpriority ept vpid fsgsbase sme

$ lspci -nn
00:00.0 Host bridge [0600]: Intel Corporation Xeon E3-1200 v2/3rd Gen Core 
processor DRAM Controller [8086:0150] (rev 09)
00:02.0 VGA compatible controller [0300]: Intel Corporation Xeon E3-1200 v2/3rd 
Gen Core processor Graphics Controller [8086:0152] (rev 09)
00:16.0 Communication controller [0780]: Intel Corporation 6 Series/C200 Series 
Chipset Family MEI Controller #1 [8086:1c3a] (rev 04)
00:1a.0 USB controller [0c03]: Intel Corporation 6 Series/C200 Series Chipset 
Family USB Enhanced Host Controller #2 [8086:1c2d] (rev 04)
00:1b.0 Audio device [0403]: Intel Corporation 6 Series/C200 Series Chipset 
Family High Definition Audio Controller [8086:1c20] (rev 04)
00:1c.0 PCI bridge [0604]: Intel Corporation 6 Series/C200 Series Chipset 
Family PCI Express Root Port 1 [8086:1c10] (rev b4)
00:1c.5 PCI bridge [0604]: Intel Corporation 6 Series/C200 Series Chipset 
Family PCI Express Root Port 6 [8086:1c1a] (rev b4)
00:1d.0 USB controller [0c03]: Intel Corporation 6 Series/C200 Series Chipset 
Family USB Enhanced Host Controller #1 [8086:1c26] (rev 04)
00:1f.0 ISA bridge [0601]: Intel Corporation H61 Express Chipset Family LPC 
Controller [8086:1c5c] (rev 04)
00:1f.2 SATA controller [0106]: Intel Corporation 6 Series/C200 Series Chipset 
Family SATA AHCI Controller [8086:1c02] (rev 04)
00:1f.3 SMBus [0c05]: Intel Corporation 6 Series/C200 Series Chipset Family 
SMBus Controller [8086:1c22] (rev 04)
02:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. 
RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 06)


$ lspci -k
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor 
DRAM Controller (rev 09)
Subsystem: Lenovo Xeon E3-1200 v2/3rd Gen Core processor DRAM Controller
Kernel driver in use: ivb_uncore
Kernel modules: ie31200_edac
00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v2/3rd Gen 
Core processor Graphics Controller (rev 09)
Subsystem: Lenovo Xeon E3-1200 v2/3rd Gen Core processor Graphics 
Controller
Kernel driver in use: i915
Kernel modules: i915
00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series 
Chipset Family MEI Controller #1 (rev 04)
Subsystem: Lenovo 6 Series/C200 Series Chipset Family MEI Controller
Kernel driver in use: mei_me
Kernel modules: mei_me
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family 
USB Enhanced Host Controller #2 (rev 04)
Subsystem: Lenovo 6 Series/C200 Series Chipset Family USB Enhanced Host 
Controller
Kernel driver in use: ehci-pci
00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family 
High Definition Audio Controller (rev 04)
Subsystem: Lenovo 6 Series/C200 Series Chipset Family High Definition 
Audio Controller
Kernel driver in use: snd_hda_intel
Kernel modules: snd_hda_intel
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI 
Express Root Port 1 (rev b4)
Kernel driver in use: pcieport
Kernel modules: shpchp
00:1c.5 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI 
Express Root Port 6 (rev b4)
Kernel driver in use: pcieport
Kernel modules: shpchp
00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family 
USB Enhanced Host Controller #1 (rev 04)
Subsystem: Lenovo 6 Series/C200 Series Chipset Family USB Enhanced Host 
Controller
Kernel driver in use: ehci-pci
00:1f.0 ISA bridge: Intel Corporation H61 Express Chipset Family LPC Controller 
(rev 04)
Subsystem: Lenovo H61 Express Chipset Family LPC Controller
Kernel driver in use: lpc_ich
Kernel modules: lpc_ich
00:1f.2 SATA 

[Bug 1808626] Re: Triple buffer flickering and weird display updating

2018-12-30 Thread P Touchman
I didn't think that Ubuntu's SimpleScreenRecorder would record the
corruption but it records it just fine:

Here's an HD video of the screen corruption:

https://www.youtube.com/watch?v=6dG_awbM5oo

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1808626

Title:
  Triple buffer flickering and weird display updating

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1808626/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1830519] Re: firefox 67 keeps crashing on me

2019-05-26 Thread P Touchman
I decided to do a memory test by booting Ubuntu with the shift-key held
down and selecting memtest and surprisingly there's some bad memory
around the end of the 32GB (there's 4x8GB sticks installed).  Booting
with the kernel parameter mem=24000M seems to get the system back to
stability.

I guess the update may have used the memory space differently or maybe
the memory just all of a sudden went bad.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1830519

Title:
  firefox 67 keeps crashing on me

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/1830519/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1830519] [NEW] firefox 67 keeps crashing on me

2019-05-26 Thread P Touchman
Public bug reported:

A system that's been extremely good and stable has all of a sudden
become completely unusable after running Software Update.

After the last update, my system won't load firefox properly half of the
time.  After loading pages like youtube it crashes the tab or just
crashes the entire browser.  Sometimes it will immediately crash upon
launch and either restart the X server or just freeze.

I really don't know if it's firefox to blame or some kernel update.

My good system has become completely and totally unusable.  Terribly
frustrating.

Ubuntu 18.04.2 LTS, firefox 67.0, core i7-2600, AMD Cedar graphics.


dmesg reports:

[  139.743013] show_signal_msg: 36 callbacks suppressed
[  139.743015] Web Content[2569]: segfault at 8021 ip 3e6b02233b3f sp 
7ffd874d1988 error 4
[  140.332634] apport[2683]: segfault at 8 ip 00572d98 sp 
7fff0a7db4f0 error 6 in python3.6[40+3b2000]
[  140.332651] Process 2683(apport) has RLIMIT_CORE set to 1
[  140.332652] Aborting core
[  162.224785] gnome-software[2707]: segfault at 55dca8ef8b68 ip 
7f2ced519038 sp 7ffde7376160 error 4 in 
libglib-2.0.so.0.5600.4[7f2ced4c4000+114000]
[  221.530201] BUG: Bad page map in process IPC Launch #1  pte:696052845 
pmd:78bfc6067
[  221.530205] page:ba01da581480 count:0 mapcount:-1 
mapping: index:0x0
[  221.530208] flags: 0x17c010(dirty)
[  221.530210] raw: 0017c010   
fffe
[  221.530212] raw: ba01da5814a0 ba01da5814a0  

[  221.530213] page dumped because: bad pte
[  221.530215] addr:b80393c8 vm_flags:08100075 
anon_vma:c17218bd mapping:  (null) index:8cee1767
[  221.530216] file:  (null) fault:  (null) mmap:  
(null) readpage:  (null)
[  221.530218] CPU: 1 PID: 3113 Comm: IPC Launch #1 Not tainted 
4.15.0-50-generic #54-Ubuntu
[  221.530219] Hardware name: Hewlett-Packard HP Compaq 8200 Elite CMT PC/1494, 
BIOS J01 v02.01 04/06/2011
[  221.530220] Call Trace:
[  221.530226]  dump_stack+0x63/0x8b
[  221.530228]  print_bad_pte+0x222/0x2e0
[  221.530230]  unmap_page_range+0x881/0xd00
[  221.530232]  unmap_single_vma+0x7d/0xf0
[  221.530233]  unmap_vmas+0x51/0xb0
[  221.530235]  exit_mmap+0xb5/0x1c0
[  221.530237]  mmput+0x57/0x140
[  221.530239]  do_exit+0x295/0xb40
[  221.530241]  ? __do_page_fault+0x270/0x4d0
[  221.530243]  ? vfs_write+0x166/0x1a0
[  221.530245]  do_group_exit+0x43/0xb0
[  221.530246]  SyS_exit_group+0x14/0x20
[  221.530248]  do_syscall_64+0x73/0x130
[  221.530257]  entry_SYSCALL_64_after_hwframe+0x3d/0xa2
[  221.530259] RIP: 0033:0x7fd2f674ae06
[  221.530260] RSP: 002b:7fd2c8385518 EFLAGS: 0206 ORIG_RAX: 
00e7
[  221.530261] RAX: ffda RBX: 7fd2c420a540 RCX: 7fd2f674ae06
[  221.530262] RDX:  RSI: 003c RDI: 
[  221.530262] RBP: 7fd2c838552f R08: 00e7 R09: ff58
[  221.530263] R10: 0058 R11: 0206 R12: 03e8
[  221.530264] R13:  R14: 7fd2c83856e0 R15: 7fd2c420a540
[  221.530265] Disabling lock debugging due to kernel taint
[  221.535775] BUG: Bad rss-counter state mm:d3b63ddd idx:0 val:-1
[  221.535779] BUG: Bad rss-counter state mm:d3b63ddd idx:1 val:1
[  221.782881] BUG: Bad page map in process JS Helper  pte:80069e0e6025 
pmd:78a4ee067
[  221.782886] page:ba01da783980 count:0 mapcount:-1 
mapping: index:0x0
[  221.782889] flags: 0x17c004(referenced)
[  221.782891] raw: 0017c004   
fffe
[  221.782893] raw: ba01da7839a0 ba01da7839a0  

[  221.782894] page dumped because: bad pte
[  221.782897] addr:9865cc11 vm_flags:0871 anon_vma:  
(null) mapping:a5605d93 index:97
[  221.782903] file:{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}.xpi 
fault:ext4_filemap_fault mmap:ext4_file_mmap readpage:ext4_readpage
[  221.782906] CPU: 3 PID: 2951 Comm: JS Helper Tainted: GB
4.15.0-50-generic #54-Ubuntu
[  221.782907] Hardware name: Hewlett-Packard HP Compaq 8200 Elite CMT PC/1494, 
BIOS J01 v02.01 04/06/2011
[  221.782908] Call Trace:
[  221.782914]  dump_stack+0x63/0x8b
[  221.782916]  print_bad_pte+0x222/0x2e0
[  221.782918]  unmap_page_range+0x881/0xd00
[  221.782920]  unmap_single_vma+0x7d/0xf0
[  221.782922]  unmap_vmas+0x51/0xb0
[  221.782924]  exit_mmap+0xb5/0x1c0
[  221.782926]  mmput+0x57/0x140
[  221.782928]  do_exit+0x295/0xb40
[  221.782930]  do_group_exit+0x43/0xb0
[  221.782932]  get_signal+0x27b/0x590
[  221.782935]  do_signal+0x37/0x730
[  221.782939]  ? do_futex+0x325/0x500
[  221.782941]  ? SyS_madvise+0x4ac/0x920
[  221.782943]  ? SyS_futex+0x13b/0x180
[  221.782945]  exit_to_usermode_loop+0x73/0xd0
[  221.782947]  do_syscall_64+0x121/0x130
[  

[Bug 1829415] Re: printing bitset to_string().c_str() in template produces junk

2019-05-18 Thread P Touchman
I took the code out of the bigger program and made another small program
to show the bug:

=

#include 
#include 
#include 
#include 
#include 
#include 

template  const char * mybitset(mytype myobj){ 
return std::bitset(myobj).to_string().c_str(); }
template  const char * mybitset2(int myobj){ return 
std::bitset(myobj).to_string().c_str(); }


#define bitsetvalue 0x255+0xf000

int main (int argc, char *argv[]) { 
printf("COMPILER VERSION %s\n",__VERSION__);
printf("bitset 32 %s  \n",std::bitset<32>(bitsetvalue).to_string().c_str());
printf("bitset 16 %s  \n",std::bitset<16>(bitsetvalue).to_string().c_str());
printf("bitset 15 %s  \n",std::bitset<15>(bitsetvalue).to_string().c_str());
printf("testing mybitset 32 %s  \n",mybitset<32,int>(bitsetvalue));
printf("testing mybitset 16 %s  \n",mybitset<16,int>(bitsetvalue));
printf("testing mybitset 15 %s  \n",mybitset<15,int>(bitsetvalue));
printf("testing mybitset 15 %s  \n",mybitset<15>(bitsetvalue));
printf("testing mybitset %s size %ld  
\n",mybitset<32>(bitsetvalue),strlen(mybitset<32>(bitsetvalue)));
printf("testing mybitset %s size %ld  
\n",mybitset<32,int>(bitsetvalue),strlen(mybitset<32,int>(bitsetvalue)));
printf("testing mybitset %s size %ld  
\n",mybitset<4,int>(bitsetvalue),strlen(mybitset<4,int>(bitsetvalue)));
printf("testing mybitset %s size %ld  
\n",mybitset<8,int>(bitsetvalue),strlen(mybitset<8,int>(bitsetvalue)));
printf("testing mybitset %s size %ld  
\n",mybitset<12,int>(bitsetvalue),strlen(mybitset<12,int>(bitsetvalue)));
printf("testing mybitset %s size %ld  
\n",mybitset<15,int>(bitsetvalue),strlen(mybitset<15,int>(bitsetvalue)));
printf("testing mybitset %s size %ld  
\n",mybitset<16,int>(bitsetvalue),strlen(mybitset<16,int>(bitsetvalue)));
printf("testing mybitset2 16 %s  \n",mybitset2<16>(bitsetvalue));
printf("testing mybitset2 15 %s  \n",mybitset2<15>(bitsetvalue));

}
=

and the output gets:

$ g++ mybitsetsimple.cpp;./a.out
COMPILER VERSION 7.4.0
bitset 32 001001010101  
bitset 16 001001010101  
bitset 15 111001001010101  
testing mybitset 32   
testing mybitset 16   
testing mybitset 15 111001001010101  
testing mybitset 15 111001001010101  
testing mybitset  size 0  
testing mybitset  size 0  
testing mybitset 0101 size 4  
testing mybitset 01010101 size 8  
testing mybitset 001001010101 size 12  
testing mybitset 111001001010101 size 15  
testing mybitset  size 0  
testing mybitset2 16   
testing mybitset2 15 111001001010101

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1829415

Title:
  printing bitset to_string().c_str()  in template produces  junk

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-7/+bug/1829415/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1829415] [NEW] printing bitset to_string().c_str() in template produces junk

2019-05-16 Thread P Touchman
Public bug reported:


I am trying to print a bitset with printf using a template, but I keep getting 
junk on the output.

I can print a bitset with
printf("%s",std::bitset<32>(valuetoprint).to_string().to_cstr());

but I thought it would be nice to do that with a template so I could
just go:

printf("%s",mybitset<32>(valuetoprint));


template  const char * mybitset(mytype myobj){ 
return std::bitset(myobj).to_string().c_str(); }

template  const char * mybitset2(int myobj){ return
std::bitset(myobj).to_string().c_str(); }

template  const char * mybitset3(int myobj){ return
std::bitset(myobj).template
to_string,std::allocator>().c_str(); }

template  const char * mybitset4(int myobj){ return
std::bitset(myobj).template
to_string,std::allocator>().c_str();
}

template  std::string mybitset5(int myobj){ return
std::bitset(myobj).template
to_string,std::allocator>(); }


printf("testing bitset32 %s  " 
,std::bitset<32>(0x255+0xf000).to_string().c_str());
printf("testing bitset16 %s  " 
,std::bitset<16>(0x255+0xf000).to_string().c_str());
printf("testing mybitset32 %s  "   ,mybitset<32,int>(0x255+0xf000));
printf("testing mybitset8 %s  ",mybitset<8,int>(0x255+0xf000));
printf("testing mybitset2 16 %s  " ,mybitset2<16>(0x255+0xf000));
printf("testing mybitset2 15 %s "  ,mybitset2<15>(0x255+0xf000));
printf("testing mybitset2 8 %s "   ,mybitset2<8>(0x255+0xf000));
printf("testing mybitset2 16 %s "  ,mybitset2<16>(0x255+0xf000));
printf("testing mybitset3 15 %s "  ,mybitset3<15>(0x255+0xf000));
printf("testing mybitset3 8 %s "   ,mybitset3<8>(0x255+0xf000));
printf("testing mybitset3 16 %s \n",mybitset3<16>(0x255+0xf000));
printf("testing mybitset4 16 %s \n",mybitset4<16>(0x255+0xf000));

std::cout << "mybitset5" << mybitset5<16>(0x255+0xf000) << "\n";


and the output I get is:

testing bitset32 001001010101  testing bitset16 
001001010101  testing mybitset32 `w�3V  testing mybitset8 01010101  
testing mybitset2 16 `w�3V  testing mybitset2 15 111001001010101 testing 
mybitset2 8 01010101 testing mybitset2 16 `w�3V  testing mybitset3 15 
111001001010101 testing mybitset3 8 01010101 testing mybitset3 16 `w�3V  
testing mybitset4 16 `w�3V  
mybitset5001001010101

So my template works fine up until I try to make it print a bitset of
size 16.  It works fine for a bitset of size 15 but not for 16.

I also tried this compiling with clang and it did the same thing,
outputting garbage, working fine for a template with bitset size 15 and
garbage for 16.

** Affects: gcc-7 (Ubuntu)
 Importance: Undecided
 Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1829415

Title:
  printing bitset to_string().c_str()  in template produces  junk

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-7/+bug/1829415/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs